open-discussion > Trying Docker version
Showing 1-16 of 16 posts
Display:
Results per page:
May 24, 2023  08:05 PM | Dianne Patterson
Trying Docker version
Thanks so much for creating a Docker version of the tool! This makes all the difference for me.

I was unable to download the Docker image from NITRC:  When I select the file link, I briefly see a new tab appear in the browser and then it disappears.  I did download the image from Dockerhub, and ran it like this on my Mac (Monterey).

docker run --rm -it -v ${PWD}:/input dmc2/mri_reface /input/anat/sub-219_ses-itbs_T1w.nii /input/out -imType T1

This seems to have worked, and generated 4 files:

% tree out
out
├── sub-219_ses-itbs_T1w_deFaced.nii
├── sub-219_ses-itbs_T1w_to_MCALT_FaceTemplate_Affine.txt
├── sub-219_ses-itbs_T1w_to_MCALT_FaceTemplate_InverseWarp.nii
└── sub-219_ses-itbs_T1w_to_MCALT_FaceTemplate_Warp.nii

1 directory, 4 files


However, it had some complaints (see below)

By: Christopher G. Schwarz schwarz.christopher@mayo.edu
Temp directory: /tmp/tp060b9dea_4081_4701_a89c_a72e385e87df
Target file: /input/anat/sub-219_ses-itbs_T1w.nii
Output directory: /input/out
Target image type: T1
Template: /root/.mcrCache9.4/mri_re0/images/MCALT_FaceTemplate_T1.nii
Face atlas: /root/.mcrCache9.4/mri_re0/images/MCALT_FaceMask.nii

Calculating affine parameters to template. This will take some time.
Using face-optimized affine.
Estimating warp to template using ANTS. This will take a while.
Transforming images to input space using antsApplyTransforms
Finding face regions using the atlas
Matching intensities of warped-template to input (DBC)
Adding Rician noise to template to match noise levels in input image, with multiplier 1
Estimated noise PSF: 0
Noise in target image norm region: 6.187167 (2.791533%)
Noise in template image norm region: 2.160575 (0.974810%)
Noise to add: 5.797668 (2.615798%)
Noise in target image air: 0.440074 (16.009274%)
Noise in template image air: 0.027489 (1.000019%)
Noise to add in air: 0.439215 (210.910828%))
Replacing face
Replacing air
Saving outputs
Saved: sub-219_ses-itbs_T1w_deFaced.nii
Generating renders for QC use
Can't reload '/usr/local/MATLAB/MATLAB_Runtime/v94/bin/glnxa64/libmwcoder_types.so'
Error in ADIR_deNoseWrap (line 70)
Error in ADIR_CreateFaceRender_Basic (line 89)
Error in ADIR_ReFace_Renders (line 164)
Error in ADIR_ReFace (line 1118)
MATLAB:dispatcher:loadLibrary

Should I be concerned about the complaints?
May 24, 2023  08:05 PM | Christopher Schwarz - Mayo Clinic
RE: Trying Docker version
Dianne,
We did not put any Docker image on Dockerhub, so you are using an old version that was not created by us.

The version on nitrc does not have this error. Please try again to download it from
http://mri_reface.projects.nitrc.org/mri...
or else contact nitrc support to help with your download issue.

This version will not have that error.

Thanks,
Chris Schwarz
May 25, 2023  03:05 PM | Christopher Schwarz - Mayo Clinic
RE: Trying Docker version
Dianne,
I think I have now corrected the issue that was making the Docker image file not download upon clicking from the nitrc download page. It was always available by pasting the url, but now it should work via clicking as well. I had used http:// instead of https:// and that appears to make the difference. Please try again.

Thanks,
Chris Schwarz
May 25, 2023  10:05 PM | Dianne Patterson
RE: Trying Docker version
Dear Christopher,

Thank you so much for directing me to the correct way to download the Docker image!  For NIfTI refacing, I ran it quite successfully using your bash script on my Mac.

However, my attempt to do dicom-to-dicom refacing failed to create revised dicoms on my machine, although the message below claims the files were written to temp.  The DICOM conversion DID create the NIfTI output.

T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.nii
T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.png
T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_deFaced.nii
T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_deFaced.png
T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_to_MCALT_FaceTemplate_Affine.txt
T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_to_MCALT_FaceTemplate_InverseWarp.nii
T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_to_MCALT_FaceTemplate_Warp.nii

and it created an additional directory "dcm", but it is empty.

Is this a bind mount issue, or am I missing an option?


dpat@saci 219 % run_mri_reface_docker.sh T1_mprage_1mm_13 out -imType T1

You provided a directory for an input, rather than a nii file. We will assume it contains DICOM for a single series. Using the -imType flag is highly recommended with this workflow.
Running dcm2niix to convert to nii
Chris Rorden's dcm2niiX version v1.0.20230411 (JP2:OpenJPEG) (JP-LS:CharLS) GCC8.4.0 x86-64 (64-bit Linux)
Found 176 DICOM file(s)
Convert 176 DICOM as /tmp/tmp.0Ck14wBMpy/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13 (256x256x176x1)
Conversion required 1.763774 seconds (0.552646 for core code).
'/tmp/tmp.0Ck14wBMpy/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.nii' -> '/var/folders/34/ylkzx8hn52q2p5d_23pc90ww0000gn/T/tmp.Mf9RI3jY/outputs/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.nii'
-------------------------------------------------------
Running mri_reface, version 0.3.2
By: Christopher G. Schwarz schwarz.christopher@mayo.edu
Temp directory: /tmp/tpd3f669d5_b341_40d7_a590_73886f1cb92c
Target file: /tmp/tmp.0Ck14wBMpy/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.nii
Output directory: /var/folders/34/ylkzx8hn52q2p5d_23pc90ww0000gn/T/tmp.Mf9RI3jY/outputs
Target image type: T1
Template: /root/.mcrCache9.12/mri_re0/mri_reface/images/MCALT_FaceTemplate_T1.nii
Face atlas: /root/.mcrCache9.12/mri_re0/mri_reface/images/MCALT_FaceMask.nii

Calculating affine parameters to template. This will take some time.
Using face-optimized affine.
Estimating warp to template using ANTS. This will take a while.
Transforming images to input space using antsApplyTransforms
Finding face regions using the atlas
Matching intensities of warped-template to input (DBC)
Adding Rician noise to template to match noise levels in input image, with multiplier 1
Estimated noise PSF: 0
Noise in target image norm region: 6.187167 (2.791533%)
Noise in template image norm region: 2.160575 (0.974810%)
Noise to add: 5.797668 (2.615798%)
Noise in target image air: 0.440074 (16.009274%)
Noise in template image air: 0.027489 (1.000019%)
Noise to add in air: 0.439215 (210.910828%))
Replacing face
Replacing air
Saving outputs
Saved: T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_deFaced.nii
Generating renders for QC use
Saved: T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.png
Saved: T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_deFaced.png
ADIR_ReFace finished in: 20.571 minutes
Traceback (most recent call last):
File "/usr/bin/mlrtapp/ADIR_nii2dicom", line 72, in
nii2dicom(args[''], args[''], args[''],verbose=args.get('--verbose',False),sliceDim=int(args.get('--sliceDim')),modality_default=str(args.get('--modality')),manufacturer_default=str(args.get('--manufacturer')),photometric_default=str(args.get('--photometric')),dry_run=args.get('--dry-run',False),uid_root=str(args.get('--UID_ROOT')),seriesNUM_select=args.get('--seriesNUM_select',None),seriesUID_select=args.get('--seriesUID_select',None))
File "/usr/bin/mlrtapp/image_handling/ADIR_nii2dicom.py", line 110, in nii2dicom
dicom_0 = dicom.dcmread(gzip.open(dcmfiles[0],mode='rb')) if(dcmfiles[0][-3:] == '.gz') else dicom.dcmread(dcmfiles[0])
IndexError: list index out of range
DICOM file directory is empty.
De-faced DICOM was written to /var/folders/34/ylkzx8hn52q2p5d_23pc90ww0000gn/T/tmp.Mf9RI3jY/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.

Thank you for your time and the great project!

-Dianne

May 26, 2023  08:05 PM | Christopher Schwarz - Mayo Clinic
RE: Trying Docker version

Hi Dianne,


I admit I'm not sure why you're getting that output in the nii to dicom step. It's not finding the original dicom during that last nii2dicom step of the process, but of course it found them earlier in the process, so it's rather confusing. If you want to otherwise de-identify the dicom and send them to me, we can test it on our end and see if we can reproduce your error, but I understand that you likely wouldn't be able to do this. You could try running the programs inside the Docker interactively, either to troubleshoot or to pick up with running ADIR_nii2dicom on the de-faced nii with the original dicom. If you have the defaced nifti and it looks good, you also could try something like this to run just the nii2dicom step inside the docker, from outside the docker:


docker run -ti --mount type=bind,src\=,target=/nifti_dir type=bind,src\=,target=/output_dir type=bind,src\=,target=/original_dicom_dir mri_reface /usr/bin/mlrtapp/ADIR_nii2dicom /nifti_dir/ /output_dir /original_dicom_dir -v


where , , , and are replaced with the paths to your files.  The output directory will need to be writable by everyone.  The ownership of the files in will likely need to be changed after running.


 


As a different workaround, you could also download the non-docker version of mri_reface and install just the included nii2dicom and markDicomDeidentified programs on your mac. Those have relatively minimal dependencies, so if the nifti de-facing steps work inside the docker, you could finish the last part in your python environment outside the docker, if you have to. 


Does any of that help?
Best,


Chris


 

May 28, 2023  01:05 AM | Dianne Patterson
RE: Trying Docker version

Hi Chris,


Fortunately, this is me, so these DICOMS are posted publicly for my students to use. Here's the dataset:  https://osf.io/mqgzh


Since I'm running on mac, I don't have to worry about the ownership issue.


I went inside the container:



docker run -ti -v ${PWD}/out:/nifti_dir -v ${PWD}/out/dcm:/output_dir -v ${PWD}/T1_mprage_1mm_13:/original_dicom_dir  mri_reface



Then I went to the root and made sure all the bind mounts worked (they looked good)


Conversion works if I specify the NiFTI file to convert, but not if I specify just the directory containing it:



 root@0cef076d50e6:/# /usr/bin/mlrtapp/ADIR_nii2dicom nifti_dir/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_deFaced.nii output_dir



WARNING: Study Instance UID not found, generating new UID.
WARNING: Frame Instance UID not found, generating new UID.
Finished writing 256 dcm files to outDir: output_dir



The dcm files have tags and I can convert them to NIfTI with dcm2niix so this seems to succeed!


________


However, if I try to additionally specify the originalDicomDir, I get an error:



root@797ec2f975da:/# /usr/bin/mlrtapp/ADIR_nii2dicom nifti_dir/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_deFaced.nii output_dir original_dicom_dir


Traceback (most recent call last):
  File "/usr/bin/mlrtapp/ADIR_nii2dicom", line 72, in <module>
    nii2dicom(args['<nii>'], args['<outDir>'], args['<originalDicomDir>'],verbose=args.get('--verbose',False),sliceDim=int(args.get('--sliceDim')),modality_default=str(args.get('--modality')),manufacturer_default=str(args.get('--manufacturer')),photometric_default=str(args.get('--photometric')),dry_run=args.get('--dry-run',False),uid_root=str(args.get('--UID_ROOT')),seriesNUM_select=args.get('--seriesNUM_select',None),seriesUID_select=args.get('--seriesUID_select',None))
  File "/usr/bin/mlrtapp/image_handling/ADIR_nii2dicom.py", line 110, in nii2dicom
    dicom_0 = dicom.dcmread(gzip.open(dcmfiles[0],mode='rb')) if(dcmfiles[0][-3:] == '.gz') else dicom.dcmread(dcmfiles[0])
IndexError: list index out of range



If I try from outside the container, I also have less luck, even though I am only specifying the NIfTI image and the output directory, as I did inside the container:



dpat@saci 219 % docker run -ti -v ${PWD}/out:/nifti_dir -v ${PWD}/out/dcm:/output_dir mri_reface /usr/bin/mlrtapp/ADIR_nii2dicom nifti_dir/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_deFaced.nii output_dir


Traceback (most recent call last):
  File "/usr/bin/mlrtapp/ADIR_nii2dicom", line 72, in <module>
    nii2dicom(args['<nii>'], args['<outDir>'], args['<originalDicomDir>'],verbose=args.get('--verbose',False),sliceDim=int(args.get('--sliceDim')),modality_default=str(args.get('--modality')),manufacturer_default=str(args.get('--manufacturer')),photometric_default=str(args.get('--photometric')),dry_run=args.get('--dry-run',False),uid_root=str(args.get('--UID_ROOT')),seriesNUM_select=args.get('--seriesNUM_select',None),seriesUID_select=args.get('--seriesUID_select',None))
  File "/usr/bin/mlrtapp/image_handling/ADIR_nii2dicom.py", line 76, in nii2dicom
    nii = nib.load(niifile)
  File "/usr/local/lib/python2.7/dist-packages/nibabel/loadsave.py", line 42, in load



This is as far as I've gotten. I appreciate your time.


-Dianne


 

May 29, 2023  03:05 AM | Dianne Patterson
RE: Trying Docker version

I tried the dicom processing on an Ubuntu 22.04.2 machine (in case some subtle difference in the Mac's implementation of Bash or docker was responsible).  However, I see the same problem: The dcm directory is created but empty:



[dema:219 () 1139] $ /data/mri_reface/code/mri_reface_docker/run_mri_reface_docker.sh  T1_mprage_1mm_13 out -imType T1
You provided a directory for an input, rather than a nii file. We will assume it contains DICOM for a single series. Using the -imType flag is highly recommended with this workflow.
Running dcm2niix to convert to nii
Chris Rorden's dcm2niiX version v1.0.20230411  (JP2:OpenJPEG) (JP-LS:CharLS) GCC8.4.0 x86-64 (64-bit Linux)
Found 176 DICOM file(s)
Convert 176 DICOM as /tmp/tmp.8EJP90LOFN/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13 (256x256x176x1)
Conversion required 0.087747 seconds (0.087351 for core code).
'/tmp/tmp.8EJP90LOFN/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.nii' -> '/var/tmp/tmp.f8OpIJxbk0/outputs/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.nii'
-------------------------------------------------------
Running mri_reface, version 0.3.2
By: Christopher G. Schwarz schwarz.christopher@mayo.edu
Temp directory: /tmp/tp23bd9256_ce04_40d4_a0bf_29a3a0d86f6c
Target file: /tmp/tmp.8EJP90LOFN/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.nii
Output directory: /var/tmp/tmp.f8OpIJxbk0/outputs
Target image type: T1
Template: /root/.mcrCache9.12/mri_re0/mri_reface/images/MCALT_FaceTemplate_T1.nii
Face atlas: /root/.mcrCache9.12/mri_re0/mri_reface/images/MCALT_FaceMask.nii


Calculating affine parameters to template. This will take some time.
Using face-optimized affine.
Estimating warp to template using ANTS. This will take a while.
Transforming images to input space using antsApplyTransforms
Finding face regions using the atlas
Matching intensities of warped-template to input (DBC)
Adding Rician noise to template to match noise levels in input image, with multiplier 1
Estimated noise PSF: 0
Noise in target image norm region: 6.187167 (2.791533%)
Noise in template image norm region: 2.160575 (0.974810%)
Noise to add: 5.797668 (2.615798%)
Noise in target image air: 0.440074 (16.009274%)
Noise in template image air: 0.027489 (1.000019%)
Noise to add in air: 0.439215 (210.910828%))
Replacing face
Replacing air
Saving outputs
Saved: T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_deFaced.nii
Generating renders for QC use
Saved: T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.png
Saved: T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13_deFaced.png
ADIR_ReFace finished in: 9.0485 minutes
Traceback (most recent call last):
  File "/usr/bin/mlrtapp/ADIR_nii2dicom", line 72, in <module>
    nii2dicom(args['<nii>'], args['<outDir>'], args['<originalDicomDir>'],verbose=args.get('--verbose',False),sliceDim=int(args.get('--sliceDim')),modality_default=str(args.get('--modality')),manufacturer_default=str(args.get('--manufacturer')),photometric_default=str(args.get('--photometric')),dry_run=args.get('--dry-run',False),uid_root=str(args.get('--UID_ROOT')),seriesNUM_select=args.get('--seriesNUM_select',None),seriesUID_select=args.get('--seriesUID_select',None))
  File "/usr/bin/mlrtapp/image_handling/ADIR_nii2dicom.py", line 110, in nii2dicom
    dicom_0 = dicom.dcmread(gzip.open(dcmfiles[0],mode='rb')) if(dcmfiles[0][-3:] == '.gz') else dicom.dcmread(dcmfiles[0])
IndexError: list index out of range
DICOM file directory is empty.
De-faced DICOM was written to /var/tmp/tmp.f8OpIJxbk0/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.
[dema:219 () 1140] $



 

May 30, 2023  11:05 PM | Christopher Schwarz - Mayo Clinic
RE: Trying Docker version

Dianne,


Thanks for posting the DICOMs. I'm on holiday this week, but I can download them and take a look when I return next week. I will get back to you. Sorry for the trouble.


Chris Schwarz

May 31, 2023  02:05 AM | Dianne Patterson
RE: Trying Docker version

Thank you for developing this nice tool...and for being willing to look into it.  I hope you have a great holiday.

Jun 6, 2023  07:06 PM | Christopher Schwarz - Mayo Clinic
RE: Trying Docker version

Dianne,


I was able to download your dicom and reproduce your error. I get the same error when I simply run dcm2niix on the dicom, then ADIR_nii2dicom on the nii with the original dicom. So, the error isn't in the de-facing at all but just in converting from dicom->nii and nii->dicom with these particular inputs. We'll debug from here and get back to you soon. 


Chris


 


$ dcm2niix -o dcm2niix ./MRIS/dicom/219/itbs/T1_mprage_1mm_13


Chris Rorden's dcm2niiX version v1.0.20221013  (JP2:OpenJPEG) GCC4.8.5 x86-64 (64-bit Linux)
Found 176 DICOM file(s)
Convert 176 DICOM as dcm2niix/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13a (256x256x176x1)
Conversion required 1.046187 seconds (0.340000 for core code).


$ ADIR_nii2dicom dcm2niix/T1_mprage_1mm_13_T1_mprage_1mm_20180706110327_13.nii dcm2niix/nii2dicom ./MRIS/dicom/219/itbs/T1_mprage_1mm_13
Traceback (most recent call last):
  File "/bin/ADIR_nii2dicom", line 72, in <module>
    nii2dicom(args['<nii>'], args['<outDir>'], args['<originalDicomDir>'],verbose=args.get('--verbose',False),sliceDim=int(args.get('--sliceDim')),modality_default=str(args.get('--modality')),manufacturer_default=str(args.get('--manufacturer')),photometric_default=str(args.get('--photometric')),dry_run=args.get('--dry-run',False),uid_root=str(args.get('--UID_ROOT')),seriesNUM_select=args.get('--seriesNUM_select',None),seriesUID_select=args.get('--seriesUID_select',None))
  File "ADIR_nii2dicom.py", line 110, in nii2dicom
    dicom_0 = dicom.dcmread(gzip.open(dcmfiles[0],mode='rb')) if(dcmfiles[0][-3:] == '.gz') else dicom.dcmread(dcmfiles[0])
IndexError: list index out of range


 

Jun 6, 2023  08:06 PM | Dianne Patterson
RE: Trying Docker version
Is this the issue?

 



 



-Dianne



Jun 7, 2023  03:06 PM | Christopher Schwarz - Mayo Clinic
RE: Trying Docker version

Dianne,


I think I found the issue. Could you please try swapping in the attached copy of ADIR_nii2dicom.py for the one in mri_reface/ADIR_nii2dicom/ADIR_nii2dicom and see if that solves it for you? If it does, we can make this change in the next version. 



Thanks,


Chris

Attachment: ADIR_nii2dicom.py
Jun 9, 2023  08:06 PM | Dianne Patterson
RE: Trying Docker version

The dcm directory is empty again.  I'm attaching a pdf that details my steps for testing.
My revised container works fine on NIfTI input, but continues to refuse to generate the revised DICOM files.  

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

Nov 2, 2023  06:11 PM | Adam Raikes
RE: Trying Docker version

I haven't seen any resolution to this issue, but wanted to give my experience.


I created a Singularity container from the current Docker image for use with the system I have access to. Binding the updated ADIR_nii2dicom.py as /usr/bin/mlrtapp/image_handling/ADIR_nii2dicom.py solved this problem for us.

Nov 17, 2023  10:11 PM | Christopher Schwarz - Mayo Clinic
RE: Trying Docker version

Originally posted by Adam Raikes:



I haven't seen any resolution to this issue, but wanted to give my experience.


I created a Singularity container from the current Docker image for use with the system I have access to. Binding the updated ADIR_nii2dicom.py as /usr/bin/mlrtapp/image_handling/ADIR_nii2dicom.py solved this problem for us.



Adam,


I'm sorry you had to do that. I was waiting for confirmation from Dianne and largely forgot about this.


Today I released a new version 0.3.3 that includes this fix (and some other unrelated ones).


Thanks,


Chris