open-discussion > RE: Trying Docker version
Jun 13, 2023  12:06 AM | Christopher Schwarz - Mayo Clinic
RE: Trying Docker version

Dianne,


Thanks for posting the steps you followed. I followed your steps to create the updated image and I called it mri_reface2, as you did. I then exited and went into mri_reface2 in a new terminal and verified that the updated copy of ADIR_nii2dicom.py was still there.


$ docker run -ti mri_reface2
root@55793afdac4c:/usr/bin/mlrtapp/image_handling# grep xml ADIR_nii2dicom.py 
            dcmfiles_temp = [i for i in dcmfiles_temp if not re.search(r'\.xml$', i) ]


The above grep result matches the code I added newly in the revision I attached previously. 


I created a new run_mri_reface_docker.sh 
$ cp run_mri_reface_docker.sh run_mri_reface2_docker.sh


Which I then edited to replace mri_reface with mri_reface2 in BOTH docker lines:
96 docker run -ti --mount type=bind,src\=$tmpdir,target=$tmpdir mri_reface2 run_mri_reface.sh $input $output_tmp ${input_array[@]:2 }
97 
98 docker run -ti --mount type=bind,src=$tmpdir,target=$tmpdir mri_reface2 chmod =777 -R $tmpdi


From there I ran it two ways. One was using run_mri_reface2_docker.sh:


$ ./run_mri_reface2_docker.sh dcm_t1 outExternal -imType T1


[...]
ADIR_ReFace finished in: 17.9749 minutes
Finished writing 176 dcm files to outDir: /tmp/tmp.A1n3Oz3nih/outputs/dcm
Including custom code sequence: code: "replace_recognizable" meaning: "Replace face, ears, and artifacts in air" designator: "mri_reface" version: "0.3.2"
Finished.
De-faced DICOM was written to /tmp/tmp.A1n3Oz3nih/outputs/dcm. This DICOM metadata is NOT otherwise de-identified. Only de-facing was performed. If you need the meta-data de-identified also, you should run it through your preferred DICOM de-identification software.


When it completed, I opened outExternal/dcm and the files are present and successful.


I also tried running the whole thing inside docker, rather than using run_mri_reface2_docker.sh


$ chmod a+wrX .
$ docker run -ti --mount type=bind,src=${PWD},target=/host mri_reface2
root@23aadd07062d:/usr/bin/mlrtapp/image_handling# cd /host
root@23aadd07062d:/host# run_mri_reface.sh dcm_t1 out2 -imType T1


[...]
ADIR_ReFace finished in: 17.8532 minutes
Finished writing 176 dcm files to outDir: out2/dcm
Including custom code sequence: code: "replace_recognizable" meaning: "Replace face, ears, and artifacts in air" designator: "mri_reface" version: "0.3.2"
Finished.
De-faced DICOM was written to out2/dcm. This DICOM metadata is NOT otherwise de-identified. Only de-facing was performed. If you need the meta-data de-identified also, you should run it through your preferred DICOM de-identification software.
root@23aadd07062d:/host# exit


Then I checked out2/dcm. The dcm files are present and valid.


I tried again using your dicom directory name, just in case that had something to do with it:


$ ./run_mri_reface2_docker.sh T1_mprage_1mm_13/ out -imType T1


And that was also successful. 


From here, I was at a bit of a loss. My best guess was that there's a mistake in one of the steps you didn't show me. Maybe you could verify that your mri_reface2 image has the updated code (via the above grep example), and you could verify that your run_mri_reface2_docker.sh replaced 'mri_reface' in BOTH 'docker' commands with 'mri_reface2'? 


Toward that hypothesis, I looked back at the start of your pdf and I think you may not have replaced the correct file/path. 
/usr/bin/mlrtapp has ADIR_nii2dicom, a program. It also has a subdirectory called image_handling. Inside image_handling is ADIR_nii2dicom.py. I intended for you to replace /usr/bin/mlrtapp/image_handling/ADIR_nii2dicom.py, NOT /usr/bin/mlrtapp/ADIR_nii2dicom, but it looks like you replaced ADIR_nii2dicom. I surprised that didn't up with a new error message when you tried to run it that way, but otherwise I think this explains why it's now working for me, but not you. 


Can you please try starting again from the original mri_reface image and copy the new ADIR_nii2dicom.py into image_handling, this time? From there, I hope it will work for you. Please let me know. Sorry my original instructions weren't clear enough about which file to replace. 


Thanks,
Chris

Threaded View

TitleAuthorDate
Dianne Patterson May 24, 2023
Sun Sar Dec 9, 2024
Christopher Schwarz Dec 9, 2024
Christopher Schwarz May 30, 2023
Dianne Patterson May 31, 2023
Dianne Patterson May 29, 2023
Dianne Patterson May 25, 2023
Christopher Schwarz May 26, 2023
Dianne Patterson May 28, 2023
Christopher Schwarz Jun 6, 2023
Dianne Patterson Jun 6, 2023
Christopher Schwarz Jun 7, 2023
Dianne Patterson Jun 9, 2023
RE: Trying Docker version
Christopher Schwarz Jun 13, 2023
Adam Raikes Nov 2, 2023
Christopher Schwarz Nov 17, 2023
Christopher Schwarz May 25, 2023
Christopher Schwarz May 24, 2023