Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Nonrigid transform causes type error #112

Open
pvandyken opened this issue Oct 21, 2021 · 3 comments
Open

BUG: Nonrigid transform causes type error #112

pvandyken opened this issue Oct 21, 2021 · 3 comments

Comments

@pvandyken
Copy link

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

  1. Follow the steps in the parcellation tutorial, including downloading the example dataset, up until step 5: Tractography Registration.
  2. Run the transform as indicated, but use -mode affine instead of -mode rigid_affine_fast. This step will work fine.
  3. 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.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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. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
 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!

@ljod
Copy link
Member

ljod commented Oct 21, 2021

Hi we will try to reproduce this so we can see what is happening. Thank you for the report! We'll keep you posted.

@shivazadeh
Copy link

Hi, I'm getting the same error using python==3.7.10 and whitematteranalysis==0.3.0.

@zhangfanmark
Copy link
Member

Hi @pvandyken @shivazadeh this issue should have been fixed with the new change. Let me know if you still have issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants