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

tmp2ind_T1.sh #1

Closed
ucigrangers opened this issue Jun 13, 2017 · 11 comments
Closed

tmp2ind_T1.sh #1

ucigrangers opened this issue Jun 13, 2017 · 11 comments

Comments

@ucigrangers
Copy link

Hi Dr. Tyszka,
First, I want to say I am very excited about this atlas.

I am currently trying to warp an individual structural scan to the CIT168_T1w_700um_MNI.nii.gz template using tmp2ind_T1.sh. The third argument calls for a prob atlas. Is this the CIT168_iAmyNuc_700um_MNI.nii.gz file included in the atlas download? What is the difference between the "i" and "p" labeled "AmyNuc" nifti files?

Ultimately, I am attempting to warp all of my individual structural scans to your T1w 700um atlas and export the individual amygdala subfields as text files to be brought up in a separate software. How might I access individual subfield NIFTI files from the atlas download in order to convert to text files? I plan on using fsl's fsl2ascii in order to convert the nifti's but any insight on this process would be extremely helpful!

Thank you so much in advance and I hope to hear from you soon.

Sincerely,
Steven Granger

@ucigrangers
Copy link
Author

Here is an example of my use and errors in attempting to run the software...
user@Sidious ~/Desktop/practice/700umatlas $ sh tmp2ind_T1.sh -t1i /567_1_MRI1_WIP_MPrage_Coronal_sense_SENSE_3_1.nii -t1t /CIT168_T1w_700um_MNI.nii.gz -pt /CIT168_iAmyNuc_700um_MNI.nii.gz
tmp2ind_T1.sh: 52: tmp2ind_T1.sh: [[: Input/output error

SyN Warp T1 template to individual space

Individual T1 :
Template T1 :
Prob Atlas :
mv: cannot stat ‘TMP2IND__Warped.nii.gz’: No such file or directory
FIELD: TMP2IND_1Warp.nii.gz
AFFINE: TMP2IND_0GenericAffine.mat
Segmentation fault

Output files

Template T1 in individual space : T1w_tmp2ind.nii.gz
Prob atlas in individual space : pA_tmp2ind.nii.gz

@jmtyszka
Copy link
Owner

Hi Steven,

Really happy to hear you like the atlas!

I'll try to answer your questions in order:

  1. The tmp2ind_T1.sh script actually warps the atlas into the individual space (ie the opposite direction from the one you stated above) - didn't want this to cause confusion down the line.

  2. The third argument should be a 4D Nifti probabilistic atlas like CIT168_pAmyNuc_700um_MNI.nii.gz. FSL also uses this format for the Harvard-Oxford probabilistic atlases (see for example $FSLDIR/data/atlases/HarvardOxford/HarvardOxford-cort-prob-1mm.nii.gz in a typical FSL 5 installation). Each 3D volume in the 4D data is a separate probabilistic map for a given tissue label (voxel intensity in range 0.0 to 1.0).

  3. The "i" and "p" prefixes in the filename refer to "integer-valued" and "probabilistic" labels respectively. We've actually moved to "d" (for deterministic) for the integer-valued labels. These would be equivalent to something like HarvardOxford-cort-maxprob-thr25-1mm.nii.gz in the FSL installation and would be 3D volumes.

  4. Apologies, I'm not sure I completely understand what you're planning on exporting as text for further analysis. Voxel values from the warped atlas or individual data, calculated volumes of subnuclei? Let me know and I'll try to dig into that a bit further for you.

@jmtyszka
Copy link
Owner

It looks like the script isn't parsing the command line arguments correctly, since there's no filename string following "Individual T1:", etc. Try making the script executable (chmod +x tmp2ind_T1.sh) then rerunning without the leading "sh" in your command line. Let me know if filenames start to appear in the initial output text from the script.

@ucigrangers
Copy link
Author

Thank you so much for the rapid reply!
My misunderstanding, but that will work great. Thanks for clarifying points 2 and 3.

My apologies for the confusion on my last question, let me rephrase. I am hoping after warping the T1 atlas and the probabilistic atlas to my structural scans that I would then be able to access the corrected NIFTI file format for each of the subfields in the output separately.

@ucigrangers
Copy link
Author

In addition, I have made tmp2ind_T1.sh executable but am still running into the same issue with and without the leading "sh". I presume since the shell and all necessary files are in the same directory I don't need to specify a path for each argument.

grangers@Sidious ~/Desktop/practice/700umatlas $ tmp2ind_T1.sh -t1i /567_1_MRI1_WIP_MPrage_Coronal_sense_SENSE_3_1.nii -t1t /CIT168_T1w_700um_MNI.nii.gz -pt /CIT168_pAmyNuc_700um_MNI.nii.gz
tmp2ind_T1.sh: command not found
grangers@Sidious ~/Desktop/practice/700umatlas $ sh tmp2ind_T1.sh -t1i /567_1_MRI1_WIP_MPrage_Coronal_sense_SENSE_3_1.nii -t1t /CIT168_T1w_700um_MNI.nii.gz -pt /CIT168_pAmyNuc_700um_MNI.nii.gz
tmp2ind_T1.sh: 52: tmp2ind_T1.sh: [[: Input/output error

SyN Warp T1 template to individual space

Individual T1 :
Template T1 :
Prob Atlas :
mv: cannot stat ‘TMP2IND__Warped.nii.gz’: No such file or directory
FIELD: TMP2IND_1Warp.nii.gz
AFFINE: TMP2IND_0GenericAffine.mat
Segmentation fault

Output files

Template T1 in individual space : T1w_tmp2ind.nii.gz
Prob atlas in individual space : pA_tmp2ind.nii.gz

@jmtyszka
Copy link
Owner

jmtyszka commented Jun 13, 2017

I didn't spot this first time round, but do you want the leading "/" for all your image files? Are they all in the root directory or the current directory? If the latter, you can either drop the "/" completely or prefix the filenames with "./"

Also, try running the script with bash rather than sh.

@jmtyszka
Copy link
Owner

I've simplified the argument handling so that both tmp2ind_*.sh scripts no longer need the argument key (eg -t1i). Try pulling the latest version (git pull ...) and see whether this fixes the weird argument handling you're experiencing. Tested this under macOS Sierra. Both "sh --version" and "bash --version" indicate that "GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)" is the underlying shell. You might want to check on your Ubuntu system too.

@ucigrangers
Copy link
Author

Looks like it ran! Thanks so much for your attention on this and rapid reply.
I see it output the "Prob atlas in individual space : pA_tmp2ind.nii.gz" into the current directory and consistently labelled but I believe there was an error in the output of the "Template T1 in individual space : T1w_tmp2ind.nii.gz".

Could this be labelled something else by the script? I see several other files generated but unsure what to make of this extra output and what is the T1 template in individual space if labelled something else. Here's an example of the extra files. I'm guessing from the warp log file that TMP2IND_Warped.nii.gz is the one I am looking for?

/home/grangers/Desktop/practice/700umatlas/TMP2IND_0GenericAffine.mat
/home/grangers/Desktop/practice/700umatlas/TMP2IND_1InverseWarp.nii.gz
/home/grangers/Desktop/practice/700umatlas/TMP2IND_1Warp.nii.gz
/home/grangers/Desktop/practice/700umatlas/TMP2IND_Warp.log
/home/grangers/Desktop/practice/700umatlas/TMP2IND_Warped.nii.gz

@ucigrangers
Copy link
Author

This is the output in the terminal window in case you need it to reference at any point

grangers@Sidious ~/Desktop/practice/700umatlas $ sh tmp2ind_T1.sh 567_1_MRI1_WIP_MPrage_Coronal_sense_SENSE_3_1.nii CIT168_T1w_700um_MNI.nii.gz CIT168_pAmyNuc_700um_MNI.nii.gz

SyN Warp T1 template to individual space

Individual T1 : 567_1_MRI1_WIP_MPrage_Coronal_sense_SENSE_3_1.nii
Template T1 : CIT168_T1w_700um_MNI.nii.gz
Prob Atlas : CIT168_pAmyNuc_700um_MNI.nii.gz
Starting SyN registration
mv: cannot stat ‘TMP2IND__Warped.nii.gz’: No such file or directory
Warping probabilistic atlas into individual space
FIELD: TMP2IND_1Warp.nii.gz
AFFINE: TMP2IND_0GenericAffine.mat
moving_image_filename: CIT168_pAmyNuc_700um_MNI.nii.gz components 1
output_image_filename: pA_tmp2ind.nii.gz
reference_image_filename: 567_1_MRI1_WIP_MPrage_Coronal_sense_SENSE_3_1.nii
[0/2]: FIELD: TMP2IND_1Warp.nii.gz
[1/2]: AFFINE: TMP2IND_0GenericAffine.mat
Not currently supported because of a lack of vector support
We check the syntax of your call ....
syntax probably ok.
output origin: [-127.582, -134.018, 128, 0]
output size: [256, 256, 208, 1]
output spacing: [1, 1, 1, 1]
output direction: 1 0 0 0
0 -0 1 0
0 -1 0 0
0 0 0 1


Output files

Template T1 in individual space : T1w_tmp2ind.nii.gz
Prob atlas in individual space : pA_tmp2ind.nii.gz

@jmtyszka
Copy link
Owner

Hi Steven,

Glad this worked out! I've fixed the issue with renaming the warped template T1 too (there was an extra underscore in the command). Let me know if everything works now and I'll close the issue.

Cheers - Mike

@ucigrangers
Copy link
Author

Looks like it worked!! Thanks so much for your attention on this!

-Steve

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

2 participants