animaDiffusionImagePreprocessing.py #87
Replies: 3 comments 2 replies
-
Hi Lorenzo,
I think the way the script work, you're suppose to give all the dicom files
instead all the dicom folder, i.e a list of all the dicom in your dicom
folder (I know that it's not really practical).
Tell me if you need anything else,
Best,
Renaud
Le lun. 2 mai 2022 à 17:53, Lorenzomarta ***@***.***> a
écrit :
… Hi everyone,
I am working with Anima to study the evolution of a glioblastoma. I am
having difficulty in the per-processing phase to obtain the files necessary
to associate the mesh with the diffusion values obtained from magnetic
resonance from a DTI files.
In particular, following the guide
https://anima.readthedocs.io/en/latest/diffusion_scripts.html#diffusion-images-preprocessing-script
I get the following output from the files indicated as necessary in the
line of code to be launched from the terminal:
'''
(base) MAC-2: Preprocessing lorenzomarta $ python3
animaDiffusionImagePreprocessing.py -b Diff.bval -D DTI_64_dir_B3000_501 /
* -d 1 -t T1.nii.gz -i Diff.nii.gz
Traceback (most recent call last):
File
"/Users/lorenzomarta/Desktop/Preprocessing/animaDiffusionImagePreprocessing.py",
line 131, in
bval = image [0x5200, 0x9230] .value [0] [0x0018, 0x9117] .value [0]
[0x0018, 0x9087] .value
File
"/Users/lorenzomarta/Library/Python/3.9/lib/python/site-packages/pydicom/dataset.py",
line 916, in getitem
elem = self._dict [tag]
KeyError: (5200, 9230)
'''
where DTI_64_dir_B3000_501 is my DICOM folder.
I do not understand the error. How can I proceed?
—
Reply to this email directly, view it on GitHub
<#87>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQLXM22XKAUM322KETEUIDVH73AXANCNFSM5U4L3QEA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
You can do something like this (following you example)
myCommand="python3 animaDiffusionImagePreprocessing.py -b Diff.bval -d 1 -t
T1.nii.gz -i Diff.nii.gz -D"
for dicom in DTI_64_dir_B3000_501 / *;
do
myCommand="$myCommand $dicom"
done
That should give you a command that work that just can just lunch in a
terminal something that look pretty scary like
/home/rhedouin/Software/Anima-Scripts-Public/diffusion/animaDiffusionImagePreprocessing.py
-b 13_BC_noddi.bval -t ../../../Structural/T13D/13_BC_T13D.nii.gz -i
13_BC_noddi.nii.gz -r 13_BC_noddi_reversed_b0.nii.gz -D
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1007454200340373658590858113205624300406.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1080927551794522828572421740250709057251.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1128132512393588910212288014868857030725.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1133722950676801911874724089147898492160.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1165275000797006852681624288247869655076.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1184635702486563648700460420425788173592.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1185469595719716271900292232857148467274.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1218447305738818378533281603437901159861.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1235050414175019272174652192462212268574.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1258028451779561773663057759934054721812.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1259458214831055220677306424063206447374.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1259647369091098948030847341839738883993.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1292500673406597323311572707230322583896.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.1300822221184084329891460748048630863933.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2008533869174364552358374075527879056641.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2012850992021550544176293077006461908538.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2058293761030412312566123657087459149977.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2082963516439096811049632310913181628182.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2139587040462351628732724419022322505194.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2159192858017162056193617857365434777581.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2178885638472606683684147089865347264714.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2199912111050166091537713746216865012216.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2241945209795925318447842356083124129595.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2243221419601170592298880292022407637679.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2267848202754690294452590975121381703548.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2282758781770390245270248821740030932962.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.2290635418693939175413529852246312497918.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.3019367508102909358122274947208444952608.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.3064581176532429519899176953061613514704.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.3078313595320094020345031207629003245356.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.3082508404569228303511139602799516828553.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.3127173367006037698681219775853290817431.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.3138064906142978532588317575287772706624.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.3199092124294297184077013126684600944220.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.3214610867215986625060453938348274690894.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4006141194383703757521640475724749432293.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4013315530315847634591244040370068147098.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4028582194810929083989990262085094545106.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4029007857803687402100818038009295648989.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4072971436874334109204280514647484750829.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4079952945516745378841604063100875999374.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4118951513532212486582702420638276273751.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4134326884637335735052148256100117397196.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4141266517842441903520764544671584104948.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4156959656348918713008201110514655475706.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4157420889236139629319784202995471254243.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4167615635714815529001026189035307805952.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4172248124976927415956352464087855080527.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4291194488598540422088832284499685928270.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.4329769266029704500365534323929955320689.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5004132827172366938255130909860873923796.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5008484438092629238893914083467735380766.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5036150979584495842083399380834874994965.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5045374855849499429233149831373902840595.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5059480258116272223921369972390347954641.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5067935984205422602501257454693572917912.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5101402601181446486714389302213080193033.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5119750978489494218465358093040167378574.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5145711839440281278184728756421540534933.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5168948225518324002331561552450843714946.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5205447856453291617412637159441174336262.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5223983784004128741304835331402688416026.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5236304279299217296641415225946721578751.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5262088399101663379112153016373129820085.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.5336758525646348793294165681032042613383.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.6030490874338085898342588528343814674036.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.6062059012189239881233828966427134946984.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.6111536100466445321863602077141289697802.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.6144630963280643652120190381588827681772.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.6195524990326334649080084577861549683737.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.6197473123951180311023534751522521692043.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.6233134412299220457476700476803178944248.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.6241881720351067626746195291516104023678.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.6263624347384478703467105037035099159193.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.6264527739880479830896497162909438164993.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7021684778459682993754383465313147109506.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7029532290173809237439993423241663391944.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7093143210241422454283748907183424997979.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7108757042688715312771857911396536560361.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7110962327907794356962075520396206786964.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7157674429600529537892364950823162399310.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7161766256555835581358159405671351663758.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7185304415566528998758223918052314558052.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7232729159428638299635081545771971038512.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7292968084141122010812954767043114755361.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.7318643411157906407598038704465425273668.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.8043069116986386612633686745948885570157.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.8083062489594725223513848803792171083571.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.8096579683239261020577824748327410981769.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.8144545224198170369271192481136949035276.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.8186243516208496982045474687043286511953.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.8241428866887038956475638772228954853424.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.8253495168936058709216936741708729848294.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.8308581320838544096693923779962659097843.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.8328548514417818444820053372140626974121.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.9016512875378022267397110395319101685128.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.9055039777304012521020888152636992219932.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.9152070330839026230737505170116917953178.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.9179248880407350109663692521248178098740.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.9191020068979494979960753436923527322947.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.9224079066772065945376656042997706685118.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.9247712850066646862283286242767814332425.dcm
13_BC_noddi_dicom/1.4.9.12.34.1.8527.9304183773505720487750769916882925194870.dcm
Le mer. 4 mai 2022 à 17:50, Lorenzomarta ***@***.***> a
écrit :
… How could I do that?
—
Reply to this email directly, view it on GitHub
<#87 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQLXM6SAGT5YWDUOS6NSLDVIKMDJANCNFSM5U4L3QEA>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Hi, I will keep only this discussion active and may be close the others which are duplicates. In fact the script does not convert dicom files to nifti (there are so many ways I prefer to let that to the user), so you cannot pass the dicom files directly to the script. You should convert first your dicom to nifti using eg dcm2niix or mrconvert that work usually well. The -D option that was mentioned above has only been tested for siemens scanner and its goal is to correct the bvec files that is sometimes flipped along some axes for those scanners after dicom conversion. Hope this helps |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I am working with Anima to study the evolution of a glioblastoma. I am having difficulty in the per-processing phase to obtain the files necessary to associate the mesh with the diffusion values obtained from magnetic resonance from a DTI files.
In particular, following the guide https://anima.readthedocs.io/en/latest/diffusion_scripts.html#diffusion-images-preprocessing-script
I get the following output from the files indicated as necessary in the line of code to be launched from the terminal:
'''
(base) MAC-2: Preprocessing lorenzomarta $ python3 animaDiffusionImagePreprocessing.py -b Diff.bval -D DTI_64_dir_B3000_501 / * -d 1 -t T1.nii.gz -i Diff.nii.gz
Traceback (most recent call last):
File "/Users/lorenzomarta/Desktop/Preprocessing/animaDiffusionImagePreprocessing.py", line 131, in
bval = image [0x5200, 0x9230] .value [0] [0x0018, 0x9117] .value [0] [0x0018, 0x9087] .value
File "/Users/lorenzomarta/Library/Python/3.9/lib/python/site-packages/pydicom/dataset.py", line 916, in getitem
elem = self._dict [tag]
KeyError: (5200, 9230)
'''
where DTI_64_dir_B3000_501 is my DICOM folder.
I do not understand the error. How can I proceed?
Beta Was this translation helpful? Give feedback.
All reactions