Closed satra closed 3 years ago
@satra the -s y
feature limits conversion to a single file, which will work for enhanced DICOM, but not classic 2D DICOM. The way that FSLeyes and MRIcroGL solve this problem is to make two calls to dcm2niix - the first uses -n -1
identifies the CRC for the SeriesUID as a list (lines begin with a tab followed by the CRC, followed by a tab, followed by output name). Since the output name is controlled by -f
, you can use this to identify particular protocols. The second call to dcm2niix provides the desired CRC, e.g. -n 4220373546
to convert just that image....
$ ./dcm2niix -n -1 ~/dcm
Chris Rorden's dcm2niiX version v1.0.20210531 Clang12.0.5 ARM (64-bit MacOS)
Found 432 DICOM file(s)
1798494139 /Users/chrisrorden/dcm/dcm_Brain_Advanced_Sequences_20201014203806_2
/Users/chrisrorden/dcm/2/0001.dcm
4220373546 /Users/chrisrorden/dcm/dcm_Brain_Advanced_Sequences_20201014203806_3
/Users/chrisrorden/dcm/3/0001.dcm
Conversion required 0.126730 seconds (0.083902 for core code).
$ ./dcm2niix -n 4220373546 ~/dcm
If you know the filename of the image you want to extract, you can use -s y
for the first call:
$./dcm2niix -n -1 -s y ~/dcm/3/0001.dcm
Chris Rorden's dcm2niiX version v1.0.20210531 Clang12.0.5 ARM (64-bit MacOS)
4220373546 /Users/chrisrorden/dcm/3/3_Brain_Advanced_Sequences_20201014203806_3
/Users/chrisrorden/dcm/3/0001.dcm
Conversion required 0.003892 seconds (0.002540 for core code).
$ ./dcm2niix -n 4220373546 ~/src/dcm_qa
In theory, these two calls could be combined by dcm2niix. However, for backward compatibility, I would suggest supporting the two calls to serve your purpose.
Alternatively, since heudiconv already has information about the DICOMs, you could also compute the CRC32 for the DICOM SeriesInstanceUID tag (0020,000E0).
import zlib
#assuming (0020,000e) UI [1.2.840.113619.2.475.5282380.4724930.23928.1602193012.79] # 56, 1 SeriesInstanceUID
uid = b'1.2.840.113619.2.475.5282380.4724930.23928.1602193012.79'
zlib.crc32(uid)
# -> 4220373546
thanks @neurolabusc
Describe the bug
This is more of a feature request than a bug, unless there is a way to do this and the help doesn't help :)
i'm trying to convert a single series but this command just converts a single slice:
in heudiconv we extract the group of files that the series belongs to and (put it in an isolated directory and then convert). but was wondering if there was a way to do that in dcm2niix itself.
Please report the complete version string:
dcm2niiX version v1.0.20210317 (JP2:OpenJPEG) (JP-LS:CharLS) GCC5.5.0 x86-64 (64-bit Linux)