questions > command line (batch in windows) error in output name
Showing 1-2 of 2 posts
Apr 13, 2020 07:04 AM | YaeJi Kim
command line (batch in windows) error in output name
Dear all,
Hello dcm2nii users and developers. First of all thank you for offering a great tool for converting medical imaging data. I am using it very well.
I have a quick question about command line on windows.
I used command to make certain output file name with these options [-f %f_%p_%s].
It supposed to turn out the result of the file named "1180473_fMRI_REST_165CLEAR_5.nii.gz", but mine shows "p_s.nii.gz".
I used recursive method for dcm2niix in each subdir named with subject ID.
Here is my batch script.
""
@echo off
path=C:\Users\user\Desktop\MRIcroGL\Resources\dcm2niix
SETLOCAL enabledelayedexpansion
for /f "delims=" %%i in ('dir /ad/s/b') do (
pushd %%i
for %%b in (*.PAR) do set par=%%b
call C:\Users\user\Desktop\MRIcroGL\Resources\dcm2niix.exe -o ./ -b y -ba n -z y -x y -f %f_%p_%s ./!par!
popd )
""
-> I have no idea why it gives weird name. Maybe it is because of batch script, but I don't know what is wrong with it.
+ here is the warning signs that I got.
Chris Rorden's dcm2niiX version v1.0.20190902 (JP2:OpenJPEG) (JP-LS:CharLS) MSC1900 (64-bit Windows)
Warning: dcm2niix PAR is not actively supported (hint: use dicm2nii)
Warning: Reported TR=2007.66ms, measured TR=2007.68ms (prospect. motion corr.?)
Warning: PAR file volumes not saved in ascending temporal order (please check re-ordering)
Warning: Distance between slices reported by slice gap+thick does not match estimate from slice positions (issue 273).
Done reading PAR header version 4.2, with 5115 slices
Philips Scaling Values RS:RI:SS = 2.64567:0:0.00154031 (see PMC3998685)
Convert 1 DICOM as .\p_sc (96x96x31x165)
-> I need help to solve the warning.
Thank you in advance.
Jean Kim
Hello dcm2nii users and developers. First of all thank you for offering a great tool for converting medical imaging data. I am using it very well.
I have a quick question about command line on windows.
I used command to make certain output file name with these options [-f %f_%p_%s].
It supposed to turn out the result of the file named "1180473_fMRI_REST_165CLEAR_5.nii.gz", but mine shows "p_s.nii.gz".
I used recursive method for dcm2niix in each subdir named with subject ID.
Here is my batch script.
""
@echo off
path=C:\Users\user\Desktop\MRIcroGL\Resources\dcm2niix
SETLOCAL enabledelayedexpansion
for /f "delims=" %%i in ('dir /ad/s/b') do (
pushd %%i
for %%b in (*.PAR) do set par=%%b
call C:\Users\user\Desktop\MRIcroGL\Resources\dcm2niix.exe -o ./ -b y -ba n -z y -x y -f %f_%p_%s ./!par!
popd )
""
-> I have no idea why it gives weird name. Maybe it is because of batch script, but I don't know what is wrong with it.
+ here is the warning signs that I got.
Chris Rorden's dcm2niiX version v1.0.20190902 (JP2:OpenJPEG) (JP-LS:CharLS) MSC1900 (64-bit Windows)
Warning: dcm2niix PAR is not actively supported (hint: use dicm2nii)
Warning: Reported TR=2007.66ms, measured TR=2007.68ms (prospect. motion corr.?)
Warning: PAR file volumes not saved in ascending temporal order (please check re-ordering)
Warning: Distance between slices reported by slice gap+thick does not match estimate from slice positions (issue 273).
Done reading PAR header version 4.2, with 5115 slices
Philips Scaling Values RS:RI:SS = 2.64567:0:0.00154031 (see PMC3998685)
Convert 1 DICOM as .\p_sc (96x96x31x165)
-> I need help to solve the warning.
Thank you in advance.
Jean Kim
Apr 13, 2020 11:04 AM | Chris Rorden
RE: command line (batch in windows) error in output name
Please upgrade to the latest stable release (v1.0.20200331)
https://github.com/rordenlab/dcm2niix/releases
The issue here is that dcm2niix is designed to convert DICOM files to NIfTI. However, your have provided files in PAR/REC format. Please export the files from your scanner to DICOM format and convert those.
While dcm2niix may work with PAR/REC files, it must deal with them differently. I suspect your specific issue is that PAR/REC forces dcm2niix to work in single file mode. I would strongly heed the warning "dcm2niix PAR is not actively supported". I have full time teaching, admin and research duties. While I am happy that my free software is generally mature, I do not have the resources to support formats that are not acquired at my center and where the raw data is too austere to provide the rich meta data required for subsequent processing.
As @drmclem (who works for Philips notes):
the PAR-REC format was built for simpler times and its always been a tension between simplicity and comprehensiveness of the format. We are not actively changing PAR-REC for the future (and the files are versioned - in the PAR file, we have been at 4.2 for quite a long time now so you can check for support versions) and have introduced the XML-REC version in the commerical software which is more extensible for the long term. So while not actively deprecated, PAR-REC is getting a bit long in the tooth.
https://github.com/rordenlab/dcm2niix/is...
While each PAR file is simple, support is difficult as the format has evolved over the years, it is not explicitly documented and different Philips tools have used this format inconsistently/incorrectly. In general, the format lacks the meta data you want for further analyses.
So each of these solutions would work:
1. export your images from the console as DICOM rather than PAR/REC.
2. Use the Matlab based dicm2nii which is easy to script
https://github.com/xiangruili/dicm2nii/b...
3. Adapt your scripts to append appropriate file names.
4. Fork dcm2niix to provide the functions you want for PAR/REC
https://github.com/rordenlab/dcm2niix/releases
The issue here is that dcm2niix is designed to convert DICOM files to NIfTI. However, your have provided files in PAR/REC format. Please export the files from your scanner to DICOM format and convert those.
While dcm2niix may work with PAR/REC files, it must deal with them differently. I suspect your specific issue is that PAR/REC forces dcm2niix to work in single file mode. I would strongly heed the warning "dcm2niix PAR is not actively supported". I have full time teaching, admin and research duties. While I am happy that my free software is generally mature, I do not have the resources to support formats that are not acquired at my center and where the raw data is too austere to provide the rich meta data required for subsequent processing.
As @drmclem (who works for Philips notes):
the PAR-REC format was built for simpler times and its always been a tension between simplicity and comprehensiveness of the format. We are not actively changing PAR-REC for the future (and the files are versioned - in the PAR file, we have been at 4.2 for quite a long time now so you can check for support versions) and have introduced the XML-REC version in the commerical software which is more extensible for the long term. So while not actively deprecated, PAR-REC is getting a bit long in the tooth.
https://github.com/rordenlab/dcm2niix/is...
While each PAR file is simple, support is difficult as the format has evolved over the years, it is not explicitly documented and different Philips tools have used this format inconsistently/incorrectly. In general, the format lacks the meta data you want for further analyses.
So each of these solutions would work:
1. export your images from the console as DICOM rather than PAR/REC.
2. Use the Matlab based dicm2nii which is easy to script
https://github.com/xiangruili/dicm2nii/b...
3. Adapt your scripts to append appropriate file names.
4. Fork dcm2niix to provide the functions you want for PAR/REC