whitematteranalysis
whitematteranalysis copied to clipboard
BUG: Nonrigid transform causes type error
Problem
When running a nonrigid transform using wm_register_to_atlas_new.py
, it crashes as soon as it tries to save the results of its first iteration with the error: TypeError: 'float' object cannot be interpreted as an integer
(see below for full trace).
Steps to reproduce
Environment
python==3.7.9
whitematteranalysis==0.3.0
Steps
- Follow the steps in the parcellation tutorial, including downloading the example dataset, up until step 5: Tractography Registration.
- Run the transform as indicated, but use
-mode affine
instead of-mode rigid_affine_fast
. This step will work fine. - Run a second transform on the affine output using nonrigid:
wm_register_to_atlas_new.py -mode nonrigid TractRegistrationAffine/example-UKF-data/output_tractography/example-UKF-data_reg.vtk ORG-Atlases-1.1.1/ORG-RegAtlas-100HCP/registration_atlas.vtk TractRegistrationNonrigid
This produces the following output:
Importing whitematteranalysis package.
<register> =========GROUP REGISTRATION============
<register> Registering to atlas.
<register> Input subject file: TractRegistrationAffine/example-UKF-data/output_tractography/example-UKF-data_reg.vtk
<register> Input atlas file: ORG-Atlases-1.1.1/ORG-RegAtlas-100HCP/registration_atlas.vtk
<register> Output directory: TractRegistrationNonrigid
<register> ============PARAMETERS=================
<register> Registration mode: nonrigid
<register> Number of fibers to analyze per subject: 20000
<register> Minimum length of fibers to analyze (in mm): 40
<register> Maximum length of fibers to analyze (in mm): 260
<register> Verbose display and intermediate image saving OFF.
<register> Starting registration...
ADD PD: [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 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. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
UPDATE NONRIGID GRID: 4 648 ==> 192 OPTIMIZER: BFGS
TractRegistrationNonrigid/example-UKF-data_reg/log_subject_00001_iteration_00001_sigma_005_grid_004.log
EXCEPTION WAS CAUGHT, total objectives: 20
vtkBSplineTransform (0x2233730)
Debug: Off
Modified Time: 44752
Reference Count: 1
Registered Events: (none)
Inverse: (0)
InverseFlag: 0
InverseTolerance: 1e-06
InverseIterations: 500
BorderMode: Zero
DisplacementScale: 1
Traceback (most recent call last):
File "/path/to/venv/bin/wm_register_to_atlas_new.py", line 372, in <module>
main()
File "/path/to/venv/bin/wm_register_to_atlas_new.py", line 345, in main
register.iterate()
File "/path/to/venv/lib/python3.7/site-packages/whitematteranalysis/congeal_to_atlas.py", line 143, in iterate
wma.io.write_transforms_to_itk_format(tx_list, outdir, id_list)
File "/path/to/venv/lib/python3.7/site-packages/whitematteranalysis/io.py", line 513, in write_transforms_to_itk_format
for s in range(extent_0[0], extent_1[0]+1):
TypeError: 'float' object cannot be interpreted as an integer
Any assistance would be appreciated!
Hi we will try to reproduce this so we can see what is happening. Thank you for the report! We'll keep you posted.
Hi, I'm getting the same error using python==3.7.10 and whitematteranalysis==0.3.0.
Hi @pvandyken @shivazadeh this issue should have been fixed with the new change. Let me know if you still have issues.