pnlbwh / pnlpipe-containers

Containers for pnlpipe software
Other
0 stars 2 forks source link

additional instructions for nrrd #18

Closed tamireszanao closed 2 years ago

tamireszanao commented 3 years ago

Hi,

I could generate structural T1 mask (I do not have T2) using pnlNipype e.g. nifti_atlas -t /home/pnlbwh/myData/str/C001523-t1.nii.gz -o /home/pnlbwh/myData/t1Mask --train ~/pnlpipe/soft_dir/trainingDataT1AHCC-8141805/trainingDataT1Masks-hdr.csv

and freesurfer segmentation using fs.py -i /home/pnlbwh/myData/str/C001523-t1.nii.gz -m /home/pnlbwh/myData/t1Mask_mask.nii.gz -o sample_freesurfer

But I previously used the container for analyzing diffusion images in nrrd format, so I would like to generate T1 masks in .nrrd too to combine them. Is it possible?

I have tried with mabs.sh (mabs.sh –t ~/pnlpipe/soft_dir/trainingDataT1AHCC-8141805/trainingDataT1Masks-hdr.csv –i C001523-T1-xc.nrrd –o sample_T1C001523-mask.nhdr​) and atlas.py -t /home/pnlbwh/myData/str/C001523-T1-xc.nrrd -o /home/pnlbwh/myData/t1MaskC001523 --train ~/pnlpipe/soft_dir/trainingDataT1AHCC-8141805/trainingDataT1Masks-hdr.csv, but did not work.

Maybe is there a manual with the updated scripts that I can consult in order to avoid disturbing you?

Thank you!

tashrifbillah commented 3 years ago

@tamireszanao , since you are becoming an intermediate GitHub user, let's teach you something that would make your report visually easier to read:

You should see the beauty of it next time you comment!

tashrifbillah commented 3 years ago

There does not seem to be anything wrong with the command you have provided:

nifti_atlas -t /home/pnlbwh/myData/str/C001523-t1.nii.gz -o /home/pnlbwh/myData/t1Mask --train ~/pnlpipe/soft_dir/trainingDataT1AHCC-8141805/trainingDataT1Masks-hdr.csv

So why?

I could generate structural T1 mask (I do not have T2) using pnlNipype

tamireszanao commented 3 years ago

Thanks, Tashrif! I apologize if I wasn't clear.

My doubt is: I did the dti preprep, tensor mask and 2 tensor whole brain tractography using nrrd/nhdr files. For generating the T1 mask I used nifti files. I assume I need to have the files in the same format to "combine" them.

Can I just convert the T1 mask into nrrd and use it for combining FreeSurfer labelmap to dwi-space registration? Or do I have to generate the T1 mask in nrrd as well?

Thanks!

tamireszanao commented 3 years ago

Sorry, please forget my question above. I understood I can't use T1 as T2 for FreeSurfer labelmap to dwi-space registration. I am trying with the command bellow as I don't have T2s. I double checked and the files are in the corresponding directory :)

pwd: /home/pnlbwh/pnlpipe/pnlscripts (docker)

./fs2dwi.py ​-f ./P001829freesurfer -t ./P001829-dwi-Ed.nhdr -m ./P001829-dwi-tensor-mask.nrrd -o ./ `

I still get "Error: Switch -f/--freesurfer is mandatory", but the freesurfer subject directory is there.

I also tried in the pipeline: ~/pnlpipe/pnlscripts$

./fs2dwi.py ​-f ~/IMAGES-ELECT/P001829_20140831/DICOM/P001829freesurfer -t ~/IMAGES-ELECT/P001829_20140831/P001829-dwi-Ed.nhdr -m ~/IMAGES-ELECT/P001829_20140831/P001829-dwi-tensor-mask.nrrd -o ./

File "./fs2dwi.py", line 171 logging.info(f'DWI resolution: {dwi_res}') ^ SyntaxError: invalid syntax

Is there something wrong with the command I am using? Thanks!!

tashrifbillah commented 3 years ago

Can you do ./fs2dwi.py --help and then construct your command? Here is an example, I see that you have missed the word direct at the end.

The command you have constructed should be good for pnlNipype/scripts/fs2dwi.py. pnlNipype is the NIFTI pipeline that has all our latest work. We have stopped active development of NRRD pipeline pnlpipe.

By the way, lot of hard work on GitHub markdown formatting ^_^ No need to use backticks (``) once you start a line with >

tashrifbillah commented 3 years ago
File "./fs2dwi.py", line 171
logging.info(f'DWI resolution: {dwi_res}')
^
SyntaxError: invalid syntax

Did you do docker run or docker shell?

tamireszanao commented 3 years ago

I did docker run!

I tried nifti_fs2dwi, but I probably cannot use it with nrrd files, right? Can I just convert them back to nifti to use nifti_fs2dwi?

nifti_fs2dwi -f ~/pnlpipe/pnlscripts/str/P001829freesurfer --dwi ~/pnlpipe/pnlscripts/diffusion/P001829-dti-Ed.nhdr --dwimask ~/myData/diffusion/P001829-dwi-tensor-mask.nrrd -o ./ direct

Making output directory Making brain.nii.gz and wmparc.nii.gz from their mgz versions Extracting B0 from DWI and masking it Traceback (most recent call last): File "/home/pnlbwh/pnlNipype/exec/nifti_fs2dwi", line 309, in FsToDwi.run() File "/home/pnlbwh/miniconda3/envs/pnlpipe3/lib/python3.6/site-packages/plumbum/cli/application.py", line 577, in run inst, retcode = subapp.run(argv, exit=False) File "/home/pnlbwh/miniconda3/envs/pnlpipe3/lib/python3.6/site-packages/plumbum/cli/application.py", line 572, in run retcode = inst.main(*tailargs) File "/home/pnlbwh/pnlNipype/exec/nifti_fs2dwi", line 157, in main '-m', self.parent.dwimask, '-o', b0masked]), shell= True) TypeError: sequence item 4: expected str instance, NoneType found

tashrifbillah commented 3 years ago

I did docker run!

Try the example I have linked here first.