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

ENH: Add a command line option to apply a transformation #143

Merged
merged 1 commit into from
Oct 5, 2023

Conversation

jhlegarreta
Copy link
Contributor

Add a command line option to apply a transformation to the obtained tractography data. Relevant for data where the brain size of the subject is significantly different (e.g. infant data) from an adult's brain size (used for the ORG atlas). The option allows to apply a scaling transformation so that the registration process to the ORG atlas data can work reasonably. The inverse transformation is automatically applied after the clustering process has finished in case the transformation file is provided.

Document the use of the transform in documentation file.

@jhlegarreta
Copy link
Contributor Author

Needs to be tested. @zhangfanmark would be great if you could or members in your lab could test this.

@JoshuaKening
Copy link

@jhlegarreta I tested but it says there is no -t option
image

@JoshuaKening
Copy link

line 209-214, wm_harden_transform.py -t "$TfmFile"
"$InputTractography" "$OutTfmTractography" "$SlicerPath"
else
xvfb-run wm_harden_transform.py -t "$TfmFile"
"$InputTractography" "$OutTfmTractography" "$SlicerPath"

"InputTractography" needs to be changed to the folder, because wm_harden_transform.py only supports folder input.

@jhlegarreta
Copy link
Contributor Author

@JoshuaKening thanks for trying. I have amended the script. Please let me know if the updated version works as expected.

@JoshuaKening
Copy link

image It seems some problems still exist in the phase of harden transform, here is the result and log. My command is as following: bash wm_apply_ORG_atlas_to_subject.sh -i altas.vtp -o output_dir -a /Users/keningzhang/Desktop/WMA_tutorial_data/ORG-Atlases-1.1.1 -s /Applications/Slicer.app/Contents/MacOS/Slicer -t T_Sup-O_left.vtk.

@SlicerDMRI SlicerDMRI deleted a comment from JoshuaKening Sep 28, 2023
@SlicerDMRI SlicerDMRI deleted a comment from JoshuaKening Sep 28, 2023
@JoshuaKening
Copy link

line 67 still need to be corrected,
image
" : t "need to be added

Add a command line option to apply a transformation to the obtained
tractography data. Relevant for data where the brain size of the subject
is significantly different (e.g. infant data) from an adult's brain size
(used for the ORG atlas). The option allows to apply a scaling
transformation so that the registration process to the ORG atlas data
can work reasonably. The inverse transformation is automatically applied
after the clustering process has finished in case the transformation
file is provided.

Document the use of the transform in documentation file.
@jhlegarreta jhlegarreta marked this pull request as ready for review September 28, 2023 18:32
@jhlegarreta
Copy link
Contributor Author

@JoshuaKening @zhangfanmark 079ba8d fixes issues with previous commits. This is ready to be merged on my side:

  • checked locally that the script is now able to run from beginning to end.
  • did not check visually the results; I leave to you that part.

@JoshuaKening
Copy link

image input setting wrong with wm_register_to_atlas_new.py , and I think erorrs caused by line 223: image

@jhlegarreta
Copy link
Contributor Author

@JoshuaKening the script runs without issues on my computer (Ubuntu 22.04):

<wm_apply_ORG_atlas_to_subject> Clean files using maximal removal.

The above is the last line of the printed messages: you can check that it is right at the end of the script.

A few thoughts:

  • Are you on macOS?
  • The line you are pointing (223) applies the wm_register_to_atlas_new.py script to a single file (see below). However, the error trace you are showing contains multiple files. Their names match with the names given by WMA to the clusters identified. Thus, I think there is something else going on.
  • Also, I see the altas name in your error trace: when running the script from beginning to end, I do not get any altas dirname. Unless your output folder name is output_dir/altas, you may want to check what output folder name you are giving: in ENH: Add a command line option to apply a transformation #143 (comment) you were giving output_dir as the output dirname.
  • Are you testing on a completely empty directory? Can you please remove the contents of the output directory and test the branch again?
  • Following the above, are you sure your local copy of the branch is clean? Can you please remove your local branch and check it out again?
  • Can you run the command find $OutTfmTractography -type f (where $OutTfmTractography would correspond to $OutputDir/${caseID}/TractRegistration. It should list all files within the folder at issue. In this case, it should contain a single file -the result of the application of the tfm transformation file on the output of the immediately previous step; if it runs without issues, can you then echo the contents in TractographyData after running TractographyData=$(find $OutTfmTractography -type f)?

@JoshuaKening
Copy link

image I think it works.

@jhlegarreta
Copy link
Contributor Author

#143 (comment):

  • "I think it works": so does the script finish its execution without errors?
  • What was the issue?

@JoshuaKening
Copy link

There are no errors now, the issue is caused by the command I input is not complete.

@jhlegarreta
Copy link
Contributor Author

There are no errors now, the issue is caused by the command I input is not complete.

OK. So ready to be merged.

Copy link
Member

@ljod ljod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks looks good

@ljod ljod merged commit 75e60c6 into SlicerDMRI:master Oct 5, 2023
1 check passed
@jhlegarreta jhlegarreta deleted the AddBrainTransformOption branch October 5, 2023 13:50
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

Successfully merging this pull request may close these issues.

None yet

3 participants