Skip to content
Commits on Source (6)
[submodule "dcm_qa"]
path = dcm_qa
url = http://github.com/neurolabusc/dcm_qa
url = https://github.com/neurolabusc/dcm_qa.git
[submodule "dcm_qa_nih"]
path = dcm_qa_nih
url = https://github.com/neurolabusc/dcm_qa_nih.git
[submodule "dcm_qa_uih"]
path = dcm_qa_uih
url = https://github.com/neurolabusc/dcm_qa_uih.git
......@@ -23,11 +23,15 @@ matrix:
before_install:
- eval "${MATRIX_EVAL}"
- git submodule update --init --depth=3 dcm_qa
- git submodule update --init --depth=3 dcm_qa_nih
- git submodule update --init --depth=3 dcm_qa_uih
script:
- mkdir build && cd build && cmake -DBATCH_VERSION=ON -DUSE_OPENJPEG=ON -DUSE_JPEGLS=true -DZLIB_IMPLEMENTATION=Cloudflare .. && make && cd -
- export PATH=$PWD/build/bin:$PATH
- cd dcm_qa && ./batch.sh && cd -
- cd dcm_qa_nih && ./batch.sh && cd -
- cd dcm_qa_uih && ./batch.sh && cd -
before_deploy:
- export DATE=`date +%-d-%b-%Y`
......
## About
DICOM files tend to have bizarre file names, for example based on the instance UID, e.g. `MR.1.3.12.2.1107.5.2.32.35131.2014031013003871821190579`. In addition, DICOM images are often 2D slices or 3D volumes that we will combine into a single unified NIfTI file. On the other hand, some enhanced DICOM images save different reconstructions (e.g. phase and magnitude) of the same image that we will want to save as separate NIfTI files. Therefore, dcm2niix attempts to provide a sensible file naming scheme.
## Basics
You request the output filename with the `-f` argument. For example, consider you convert files with `dcm2niix -f %s_%p`: in this case an image from series 3 with the protocol name `T1` will be saved as `3_T1.nii`. Here are the available parameters for file names:
- %a=antenna (coil) name (from Siemens 0051,100F)
- %b=basename (filename of first DICOM)
- %c=comments (from 0020,4000)
- %d=description (from 0008,103E)
- %e=echo number (from 0018,0086)
- %f=folder name (name of folder containing first DICOM)
- %i=ID of patient (from 0010,0020)
- %j=seriesInstanceUID (from 0020,000E)
- %k=studyInstanceUID (from 0020,000D)
- %m=manufacturer short name (from 0008,0070: GE, Ph, Si, To, UI, NA)
- %n=name of patient (from 0010,0010)
- %p=protocol name (from 0018,1030)
- %r=instance number (from 0020,0013)
- %s=series number (from 0020,0011)
- %t=time of study (from 0008,0020 and 0008,0030)
- %u=acquisition number (from 0020,0012)
- %v=vendor long name (from 0008,0070: GE, Philips, Siemens, Toshiba, UIH, NA)
- %x=study ID (from 0020,0010)
- %z=sequence name (from 0018,0024)
## Filename Post-fixes: Image Disambiguation
In general dcm2niix creates images with 3D dimensions, or 4 dimensions when the 4th dimension is time (fMRI) or gradient number (DWI). It will use the following extensions to disambiguate additional dimensions from the same series:
- _c1.._cN coil ID (only seen if saved independently for each coil)
- _e2..eN additional echoes (the first echo is implicit)
- _cNx.._cNz where C* refers to the coil name (typically only seen for uncombined data, where a separate image is generated for each antenna)
- _e1..eN echo number for multi-echo sequences
- _ph phase map
- _imaginary imaginary component of complex image
- _real real component of complex image
- _phMag rare case where phase and magnitude are saved as the 4th dimension
- _t If the trigger delay time (0020,9153) is non-zero, it will be recorded in the filename. For example, the files "T1_t178.nii" and "T1_t511" suggests that the T1 scan was acquired with two cardiac trigger delays (178 and 511ms after the last R-peak).
- _ADC Philips specific case DWI image where derived isotropic, ADC or trace volume was appended to the series. Since this image will disrupt subsequent processing, and because subsequent processing (dwidenoise, topup, eddy) will yield better derived images, dcm2niix will also create an additional image without this volume. Therefore, the _ADC file should typically be discarded. If you want dcm2niix to discard these useless derived images , use the ignore feature ('-i y').
- _ADC Philips specific case. A DWI image where derived isotropic, ADC or trace volume was appended to the series. Since this image will disrupt subsequent processing, and because subsequent processing (dwidenoise, topup, eddy) will yield better derived images, dcm2niix will also create an additional image without this volume. Therefore, the _ADC file should typically be discarded. If you want dcm2niix to discard these useless derived images, use the ignore feature ('-i y').
- _Eq is specific to [CT scans](https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Computed_Tomography_.28CT.2C_CAT.29). These scans can be acquired with variable distance between the slices of a 3D volume. NIfTI asumes all 2D slices that form a 3D stack are equidistant. Therefore, dcm2niix reslices the input data to generate an equidistant volume.
- _Tilt is specific to [CT scans](https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Computed_Tomography_.28CT.2C_CAT.29). These scans can be acquired with a gantry tilt that causes a skew that can not be stored in a NIfTI qForm. Therefore, the slices are resampled to remove the effect of tilt.
- _MoCo is appended to the ProtocolName if Image Type (0008,0008) includes the term 'MOCO'. This helps disambiguate Siemens fMRI runs where both motion corrected and raw data is stored for a single session.
## Special Characters
[Some characters are not permitted](https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names) in filenames. The following characters will be replaced with underscorces (`_`). Note that the forbidden characters vary between operating systems (Linux only forbids the forward slash, MacOS forbids forward slash and colon, while Windows forbids any of the characters listed below). To ensure that files can be easily copied between file systems, [dcm2niix restricts filenames to characters allowed by Windows](https://github.com/rordenlab/dcm2niix/issues/237).
### List of Forbidden Characters (based on Windows)
```
< (less than)
> (greater than)
: (colon - sometimes works, but is actually NTFS Alternate Data Streams)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)
```
\ No newline at end of file
## About
dcm2niix attempts to convert GE DICOM format images to NIfTI.
dcm2niix attempts to convert GE DICOM format images to NIfTI. The current generation DICOM files generated be GE equipment is quite impoverished relative to other vendors. Therefore, the amount of information dcm2niix is able to extract is relatively limited. Hopefully, in the future GE will provide more details that are critical for brain scientists.
## Diffusion Tensor Notes
As noted by Jaemin Shin (GE), the GE convention for reported diffusion gradient direction has always been in “MR physics” logical coordinate, i.e Freq (X), Phase (Y), Slice (Z). Note that this is neither “with reference to the scanner bore” (like Siemens or Philips) nor “with reference to the imaging plane” (as expected by FSL tools). This is the main source of confusion. This explains why the dcm2niix function geCorrectBvecs() checks whether the DICOM tag In-plane Phase Encoding Direction (0018,1312) is 'ROW' or 'COL'. In addition, it will generate the warning 'reorienting for ROW phase-encoding untested' if you acquire DTI data with the phase encoding in the ROW direction. If you do test this feature, please report your findings as a Github issue.
## dcm2niix Notes
In addition to reading the
In addition to the public DICOM tags, dcm2niix attempts to decode the proprietary GE Protocol Data Block (0025,101B). This is essentially a [GZip format](http://www.onicos.com/staff/iz/formats/gzip.html) file embedded inside the DICOM header. Here are comments regarding the usage of this data block:
- The VIEWORDER tag is used to set the polarity of the BIDS tag PhaseEncodingDirection, with VIEWORDER of 1 suggesting bottom up phase encoding.
- The SLICEORDER tag is used to set the SliceTiming for the BIDS tag PhaseEncodingDirection, with a SLICEORDER of 1 suggesting interleaved acquisition. Note that current versions of dcm2niix do not detect multiband for GE datasets. Therefore, the slice timing reported in the BIDS header will be incorrect for multiband acquisitions.
- There are reports that newer versions of GE equipement (e.g. DISCOVERY MR750 / 24\MX\MR Software release:DV24.0_R01_1344.a) are now storing an [XML](https://groups.google.com/forum/#!msg/comp.protocols.dicom/mxnCkv8A-i4/W_uc6SxLwHQJ) file within the Protocolo Data Block (compressed). Since the developers of dcm2niix have not had access to any of these files, dcm2niix should generate a warning when it encounters any of these images.
```
POSITION "Supine"
ENTRY "Head First"
CLINICALCOIL "C-GE_32Ch Head"
COIL "32Ch Head"
COILCOMPONENT "32 Ch Head Coil"
PLANE "AXIAL"
SEDESC "Axial rsfMRI (Eyes Open)"
HOS "0"
IMODE "2D"
PSEQ "Gradient Echo"
IOPT "MPh, EPI"
PLUG "9"
IEC_ACCEPT "ON"
FILTCHOICE "None"
BWRT "-1"
TRICKSIMG "1"
TAG_SPACE "7"
TAG_TYPE "None"
USERCV0 "1.00"
USERCV_MASK "1"
USERCV_MASK2 "0"
NUMBVALUE "1"
REOPT "1"
FLIPANG "90"
TE "30.0"
NECHO "1"
TR "3000.0"
NUMSHOTS "1"
BPMMODE "0"
AUTOTRGTYPE "0"
INITSTATE "0"
PSDTRIG "0"
SLICEORDER "1"
VIEWORDER "1"
TRREST "0"
TRACTIVE "0"
SLPERLOC "200"
ACQORDER "0"
DELACQ "Minimum"
DELACQNOAV "2"
SEPSERIES "0"
AUTOTRIGWIN "0"
FOV "22.0"
SLTHICK "3.4"
SPC "0.0"
GRXOPT "0"
SLOC1 "R0.5"
SLOC2 "A27.0"
SLOC3 "I63.3"
ELOC1 "R0.5"
ELOC2 "A27.0"
ELOC3 "S96.5"
FOVCNT1 "R0.5"
FOVCNT2 "A27.0"
NOSLC "48"
SL3PLANE "0"
SL3PLANE1 "0"
SL3PLANE2 "0"
SL3PLANE3 "0"
SPCPERPLANE1 "0.0"
SPCPERPLANE2 "0.0"
SPCPERPLANE3 "0.0"
MATRIXX "64"
MATRIXY "64"
SWAPPF "R/L"
NEX "1.00"
CONTRAST "No"
CONTAM "Yes "
TBLDELTA "0.00"
PHASEFOV "1.00"
AUTOSHIM "Off"
PHASECORR "Yes"
PAUSEDELMASKACQ "1"
GRIP_SLGROUP1 "0.500000 26.985256 16.641255 0.000000 0.000000 1.000000 0.000000 1.000000 0.000000 1.000000 0.000000 0.000000 48 0.000000 1 0.000000 0"
GRIP_NUMSLGROUPS "1"
GRIP_TRACKER "0"
GRIP_SPECTRO "0"
GRIP_NUMPSCVOL "0"
GRIP_PSCVOL1 "0"
GRIP_PSCVOL2 "0"
GRIP_PSCVOLFOV "0.000000"
GRIP_PSCVOLTHICK "0.000000"
GRIP_IRBAND_A "0"
GRIP_IRBAND_B "0"
AUTOSUBOPTIONS "0"
AUTOSCIC "0"
AUTOVOICE "0"
PRESETDELAY "0.0"
MASKPHASE "0"
MASKPAUSE "0"
GRXLOCSAVE "0"
AUTOCOIL "0"
ONETOUCHREG "0"
TEMPORALPHASES "4"
MEGFREQ "60"
DRIVERAMP "50"
MEGDIR "4"
DRIVERFREQ "60"
RFDRIVEMODE "Quadrature"
INRANGETR "0"
NAVPSCPAUSE "0"
EXCITATIONMODE "Selective"
ANATOMY "SRT%5CNone%5CT-A0100"
```
\ No newline at end of file
The [NA-MIC Wiki](https://www.na-mic.org/wiki/NAMIC_Wiki:DTI:DICOM_for_DWI_and_DTI#Private_vendor:_GE) provides a nice description of the GE diffusion tags. In brief, the B-value is stored as the first element in the array of 0043,1039. The DICOM elements 0019,10bb, 0019,10bc and 0019,10bd provide the gradient direction relative to the frequency, phase and slice. As noted by Jaemin Shin (GE), the GE convention for reported diffusion gradient direction has always been in “MR physics” logical coordinate, i.e Freq (X), Phase (Y), Slice (Z). Note that this is neither “with reference to the scanner bore” (like Siemens or Philips) nor “with reference to the imaging plane” (as expected by FSL tools). This is the main source of confusion. This explains why the dcm2niix function geCorrectBvecs() checks whether the DICOM tag In-plane Phase Encoding Direction (0018,1312) is 'ROW' or 'COL'. In addition, it will generate the warning 'reorienting for ROW phase-encoding untested' if you acquire DTI data with the phase encoding in the ROW direction. If you do test this feature, please report your findings as a Github issue. Assuming you have COL phase encoding, dcm2niix should provide [FSL format](http://justinblaber.org/brief-introduction-to-dwmri/) [bvec files](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FDT/FAQ#What_conventions_do_the_bvecs_use.3F).
## Slice Timing
Knowing the relative timing of the acquisition for each 2D slice in a 3D volume is useful for [slice time correction](https://www.mccauslandcenter.sc.edu/crnl/tools/stc) of both fMRI and DTI data. Unfortunately, current GE software does not provide a consistent way to record this.
[Some sequences](https://afni.nimh.nih.gov/afni/community/board/read.php?1,154006) encode the RTIA Timer (0021,105E) element. For example, [this dataset DV24](https://github.com/nikadon/cc-dcm2bids-wrapper/tree/master/dicom-qa-examples/ge-mr750-slice-timing) includes timing data, while [this DV26 dataset does not](https://github.com/neurolabusc/dcm_qa_nih). Even with the sequences that do encode the RTIA Timer, there is some debate regarding the accuracy of this element. In the example listed, the slice times are clearly wrong in the first volume. Therefore, dcm2niix always estimates slice times based on the 2nd volume in a time series.
In general, fMRI acquired using GE product sequence (PSD) “epi” with the multiphase option will store slice timing in the Trigger Time (DICOM 0018,1060) element. The current version of dcm2niix ignores this field, as no examples are available. In contrast, the popular PSD “epiRT” (BrainWave RT, fMRI/DTI package provided by Medical Numerics) does not save this tag (though in some cases it saves the RTIA Timer). Examples are [available](https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Slice_timing_correction) for both the “epiRT” and “epi” sequences.
## User Define Data GE (0043,102A)
This private element of the DICOM header is used to determine the phase encoding polarity. Specifically, we need to know the "Ky traversal direction" (top-down, or bottom up) and the phase encoding polarity. Unfortunately, this data is stored in a complicated, proprietary structure, that has changed with different releases of GE software. [Click here to see the definition for this structure](https://github.com/ScottHaileRobertson/GE-MRI-Tools/blob/master/GePackage/%2BGE/%2BPfile/%2BHeader/%2BRDB15/rdbm.h).
## Total Readout Time
One often wants to determine [echo spacing, bandwidth, ](https://support.brainvoyager.com/brainvoyager/functional-analysis-preparation/29-pre-processing/78-epi-distortion-correction-echo-spacing-and-bandwidth) and total read-out time for EPI data so they can be undistorted. Total readout time is influence by parallel acceleration factor, bandwidth, number of EPI lines, and partial Fourier. Not all of these parameters are available from the GE DICOM images, so a user needs to check the scanner console.
## GE Protocol Data Block
In addition to the public DICOM tags, previous versions of dcm2niix attempted to decode the proprietary GE Protocol Data Block (0025,101B). This is essentially a [GZip format](http://www.onicos.com/staff/iz/formats/gzip.html) file embedded inside the DICOM header. Unfortunately, this data seems to be [unreliable](https://github.com/rordenlab/dcm2niix/issues/163) and therefore this strategy is not used anymore. The notes below regarding the usage of this data block are provided for historical purposes.
- The VIEWORDER tag is used to set the polarity of the BIDS tag PhaseEncodingDirection, with VIEWORDER of 1 suggesting bottom up phase encoding. Unfortunately, users can separately reverse the phase encoding direction making this tag unreliable.
- The SLICEORDER tag could be used to set the SliceTiming for the BIDS tag PhaseEncodingDirection, with a SLICEORDER of 1 suggesting interleaved acquisition.
- There are reports that newer versions of GE equipement (e.g. DISCOVERY MR750 / 24\MX\MR Software release:DV24.0_R01_1344.a) are now storing an [XML](https://groups.google.com/forum/#!msg/comp.protocols.dicom/mxnCkv8A-i4/W_uc6SxLwHQJ) file within the Protocolo Data Block (compressed). In theory this might also provide useful information.
## Sample Datasets
- [A validation dataset for dcm2niix commits](https://github.com/neurolabusc/dcm_qa_nih).
- [Examples of phase encoding polarity, slice timing and diffusion gradients](https://github.com/nikadon/cc-dcm2bids-wrapper/tree/master/dicom-qa-examples/).
- The dcm2niix (wiki)[https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage] includes examples of diffusion data, slice timing, and other variations.
\ No newline at end of file
......@@ -44,3 +44,9 @@ The current version of dcm2niix uses Dimension Index Values (0020,9157) to deter
## General variations
Prior versions of dcm2niix used different methods to sort images. However, these have proved unreliable The undocumented tags SliceNumberMrPhilips (2001,100A). In theory, InStackPositionNumber (0020,9057) should be present in all enhanced files, but has not proved reliable (perhaps not in older Philips images or DICOM images that were modified after leaving the scanner). MRImageGradientOrientationNumber (2005,1413) is complicated by the inclusion of derived images. Therefore, current versions of dcm2niix do not generally depend on any of these.
## Sample Datasets
- [National Alliance for Medical Image Computing (NAMIC) samples](http://www.insight-journal.org/midas/collection/view/194)
- [Unusual Philips Examples](https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Unusual_MRI).
- [Diffusion Examples](https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Diffusion_Tensor_Imaging).
\ No newline at end of file
......@@ -34,7 +34,18 @@ Command line usage is described in the [NITRC wiki](https://www.nitrc.org/plugin
[See the BATCH.md file for instructions on using the batch processing version](./BATCH.md).
## Build
## Install
There are a couple ways to install dcm2niix
- [Github Releases](https://github.com/rordenlab/dcm2niix/releases) provides the latest compiled executables. This is an excellent option for MacOS and Windows users. However, the provided Linux executable requires a recent version of Linux, so the provided Unix executable is not suitable for all distributions.
- [MRIcroGL](https://github.com/neurolabusc/MRIcroGL/releases) includes dcm2niix that can be run from the command line or from the graphical user interface (select the Import menu item). The Linux version of dcm2niix is compiled on a holy build box, so it should run on any Linux distribution.
- If you have a MacOS computer with Homebrew you can run `brew install dcm2niix`.
- If you have Conda, [`conda install -c conda-forge dcm2niix`](https://anaconda.org/conda-forge/dcm2niix) on Linux, MacOS or Windows.
- On Debian Linux computers you can run `sudo apt-get install dcm2niix`.
## Build from source
It is often easier to download and install a precompiled version. However, you can also build from source.
### Build command line version with cmake (Linux, MacOS, Windows)
......@@ -46,6 +57,8 @@ MacOS: `brew install cmake pkg-config`
**Basic build:**
```bash
git clone https://github.com/rordenlab/dcm2niix.git
cd dcm2niix
mkdir build && cd build
cmake ..
make
......@@ -59,9 +72,7 @@ In rare case if cmake fails with the message like `"Generator: execution of make
As noted in the `Image Conversion and Compression Support` section, the software provides many optional modules with enhanced features. A common choice might be to include support for JPEG2000, [JPEG-LS](https://github.com/team-charls/charls) (this option requires a c++14 compiler), as well as using the high performance Cloudflare zlib library (this option requires a CPU built after 2008). To build with these options simply request them when configuring cmake:
```bash
mkdir build && cd build
cmake -DZLIB_IMPLEMENTATION=Cloudflare -DUSE_JPEGLS=ON -DUSE_OPENJPEG=ON ..
make
```
**optional batch processing version:**
......@@ -74,16 +85,15 @@ If you have any problems with the cmake build script described above or want to
## Alternatives
- [Valerio Luccio's dinifti](http://cbi.nyu.edu/software/dinifti.php) is focused on conversion of Siemens data.
- [dinifti](http://cbi.nyu.edu/software/dinifti.php) is focused on conversion of Siemens data.
- [dcm2nii](http://www.mccauslandcenter.sc.edu/mricro/mricron/dcm2nii.htm) is the predecessor of dcm2niix. It is deprecated for modern images, but does handle image formats that predate DICOM (proprietary Elscint, GE and Siemens formats).
- [DWIConvert](https://github.com/BRAINSia/BRAINSTools/tree/master/DWIConvert) converts DICOM images to NRRD and NIfTI formats.
- [Xiangrui Li's dicm2nii](http://www.mathworks.com/matlabcentral/fileexchange/42997-dicom-to-nifti-converter) is written in Matlab. The Matlab language makes this very scriptable.
- [dicm2nii](http://www.mathworks.com/matlabcentral/fileexchange/42997-dicom-to-nifti-converter) is written in Matlab. The Matlab language makes this very scriptable.
- [dicom2nifti](https://github.com/icometrix/dicom2nifti) uses the scriptable Python wrapper utilizes the [high performance GDCMCONV](http://gdcm.sourceforge.net/wiki/index.php/Gdcmconv) executables.
- [MRtrix mrconvert](http://mrtrix.readthedocs.io/en/latest/reference/commands/mrconvert.html) is a useful general purpose image converter and handles DTI data well. It is an outstanding tool for modern Philips enhanced images.
- [Jolinda Smith's mcverter](http://lcni.uoregon.edu/%7Ejolinda/MRIConvert/) has great support for various vendors.
- [mcverter](http://lcni.uoregon.edu/%7Ejolinda/MRIConvert/) has great support for various vendors.
- [mri_convert](https://surfer.nmr.mgh.harvard.edu/pub/docs/html/mri_convert.help.xml.html) is part of the popular FreeSurfer package. In my limited experience this tool works well for GE and Siemens data, but fails with Philips 4D datasets.
- [SPM12](http://www.fil.ion.ucl.ac.uk/spm/software/spm12/) is one of the most popular tools in the field. It includes DICOM to NIfTI conversion. Being based on Matlab it is easy to script.
- [R2A_GUI](http://r2agui.sourceforge.net/) is a Matlab script that converts Philips PAR/REC images to NIfTI.
## Links
......
## About
dcm2niix is primarily designed to convert DICOM images into NIfTI images. However, it does include a primitive ability to organize and rename DICOM images without converting them. This can be useful, as DICOM images are often stored with random file names that make it difficult to recognize the images.
## Limitation
dcm2niix renames and copies the DICOM images, but the current version does not copy or create a new [DICOMDIR](http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_F.2.2.2.html) file. Most users ignore these files. However, you should not use this featire if you wish to preserve your DICOMDIR files.
Note that this feature only copies your DICOM images with a new filename. It does not modify the contents of the DICOM header. This means it will not compress or anonymize your files. Free tools for these functions include [dcmcjpeg](https://dicom.offis.de/dcmtk.php.en), [gdcmanon](http://gdcm.sourceforge.net/html/gdcmanon.html) and [gdcmconv](http://gdcm.sourceforge.net/html/gdcmconv.html).
In addition, this tool assumes that the DICOM images can be uniquely identified by the filenaming argument you provide.
## Usage
The command line argument `-r y` instructs dcm2niix to rename your DICOM files rather than convert them. It does not delete your DICOM images, but rather creates a copy with the organization specified by the [filenaming argument `-f`](FILENAMING.md). Here is an example where the DICOM images will be sorted into folders, with the folder name reflecting the study time (`%t`) and series number (`%s`), each DICOM image will be named based on the image number (`%r`) which will be padded with zeros to fill 5 characters.
- `dcm2niix -r y -f %t_%s/%5r.dcm -o ~/out ~/in`
Therefore, the 9th DICOM image from series 3 acquired on 4 February 2012 would be saved as ~/out/20120204084424_3/00009.dcm.
It is very important that your file naming disambiguates all your images. For example, consider a naming scheme that only used the image number (`-f %r.dcm`) and was applied to multiple series (each which had an image number 1,2,...). When there are naming conflicts, dcm2niix will terminate with an error message, e.g. `Error: File naming conflict. Existing file /home/c/dcm/1.dcm`.
A special situation is the fieldmaps generated by Siemens scanners. Users often acquire gradient-echo fieldmaps so they can undistort EPI images. These fieldmaps acquire two (or more) echoes. Unfortunately, Siemens will give each of these echoes an identical series and image number. DICOM tools that are unaware of this often [overwrite](https://neurostars.org/t/field-mapping-siemens-scanners-dcm2niix-output-2-bids/2075/7) some of the images from each echo. To combat this situation, dcm2niix will add the post-fix `_e2` to the second echo. Therefore, if you converted a series with `-f %s_%4r` your fieldmap might generate files named `5_0001.dcm` and `5_0001_e2.dcm`. Note you could also explicitly number each echo (`-f %s_%4r_%e`), though in this case all your series (not just the fieldmaps) will have the echo appended.
## Alternatives
An advantage of using dcm2niix is simplicity: it is a free, single file executable that you can [download](https://github.com/rordenlab/dcm2niix/releases) that is available for MacOS, Linux and Windows that you can run from the command line. On the other hand, this simplicity means it is fairly inflexible. You may want to consider a DICOM renamer built in your favorite scripting language.
- [dicom-rename is a Python script](https://github.com/joshy/dicom-rename).
- [dicomsort is a Python script](https://github.com/pieper/dicomsort).
- [rename_dir is a Matlab script that requires the proprietary Image Processing Toolbox](https://gist.github.com/htygithub/ad3597577e1de004e9f5).
- [dicm2nii includes the Matlab script rename_dicm that does not require any additional toolboxes](https://github.com/xiangruili/dicm2nii).
\ No newline at end of file
## About
dcm2niix attempts to convert Siemens DICOM format images to NIfTI. This page describes some vendor-specific details.
## Vida XA10A
The Siemens Vida introduced the new XA10A DICOM format. Users are strongly encouraged to export data using the "Enhanced" format and to not use any of the "Anonymize" features on the console. The consequences of these options is discussed in detail in [issue 236](https://github.com/rordenlab/dcm2niix/issues/236). In brief, the Vida can export to enhanced, mosaic or classic 2D. Note that the mosaics are considered secondary capture images intended for quality assurance only. The mosaic scans lack several "Type 1" DICOM properties, necessarily limiting conversion. The non-mosaic 2D enhanced DICOMs are compact and efficient, but appear to have limited details relative to the enhanced output. Finally, each of the formats (enhanced, mosaic, classic) can be exported as anonymized. The Siemens console anonymization of current XA10A (Fall 2018) strips many useful tags. Siemens suggests "the use an offline/in-house anonymization software instead." Another limitation of the current XA10A format is that it retains no versioning details for software and hardware stepping, despite the fact that the data format is rapidly evolving. If you use a Vida, you are strongly encouraged to log every hardware or software upgrade to allow future analyses to identify and regress out any effects of these modifications. Since the XA10A format does not have a CSA header, dcm2niix will attempt to use the new private DICOM tags to populate the BIDS file. These tags are described in [issue 240](https://github.com/rordenlab/dcm2niix/issues/240).
## CSA Header
Many crucial Siemens parameters are stored in the [proprietary CSA header](http://nipy.org/nibabel/dicom/siemens_csa.html). This has a binary section that allows quick reading for many useful parameters. It also includes an ASCII text portion that includes a lot of information but is slow to parse and poorly curated.
## Slice Timing
The CSA header provides [slice timing](https://www.mccauslandcenter.sc.edu/crnl/tools/stc), and therefore dcm2niix should provide accurate slice timing information for non-XA10 datasets. For archival studies, be aware that some sequences [incorrectly reported slice timing](https://github.com/rordenlab/dcm2niix/issues/126).
## Total Readout Time
One often wants to determine [echo spacing, bandwidth, ](https://support.brainvoyager.com/brainvoyager/functional-analysis-preparation/29-pre-processing/78-epi-distortion-correction-echo-spacing-and-bandwidth) and total read-out time for EPI data so they can be undistorted. The [Siemens validation dataset](https://github.com/neurolabusc/dcm_qa/tree/master/In/TotalReadoutTime) demonstrates that dcm2niix can accurately report these parameters - the included notes and spreadsheet describe this in more detail.
## Diffusion Tensor Notes
Diffusion specific parameters are described on the [NA-MIC](https://www.na-mic.org/wiki/NAMIC_Wiki:DTI:DICOM_for_DWI_and_DTI#Private_vendor:_Siemens) website. Gradient vectors are reported with respect to the scanner bore, and dcm2niix will attempt to re-orient these to [FSL format](http://justinblaber.org/brief-introduction-to-dwmri/) [bvec files](https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FDT/FAQ#What_conventions_do_the_bvecs_use.3F).
## Sample Datasets
- [Slice timing dataset](httphttps://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Slice_timing_corrections://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage).
- [A validation dataset for dcm2niix commits](https://github.com/neurolabusc/dcm_qa).
- [A mixture of GE and Siemens data](https://github.com/neurolabusc/dcm_qa_nih).
- [DTI examples](https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Diffusion_Tensor_Imaging).
- [Archival (old) examples](https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Archival_MRI).
- [Unusual examples](https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage#Unusual_MRI).
......@@ -67,10 +67,13 @@ if(USE_OPENJPEG)
pkg_check_modules(OPENJPEG libopenjp2)
endif()
if(OPENJPEG_FOUND)
set(OpenJPEG_DIR ${OPENJPEG_LIBDIR}/openjepg-2.1 CACHE PATH "Path to OpenJPEG configuration file" FORCE)
if(OPENJPEG_FOUND AND NOT ${OPENJPEG_INCLUDE_DIRS} MATCHES "gdcmopenjpeg")
set(OpenJPEG_DIR ${OPENJPEG_LIBDIR}/openjpeg-2.1 CACHE PATH "Path to OpenJPEG configuration file" FORCE)
message("-- Using OpenJPEG library from ${OpenJPEG_DIR}")
else()
if(${OPENJPEG_INCLUDE_DIRS} MATCHES "gdcmopenjpeg")
message("-- Unable to use GDCM's internal OpenJPEG")
endif()
include(${CMAKE_SOURCE_DIR}/SuperBuild/External-OPENJPEG.cmake)
list(APPEND DEPENDENCIES openjpeg)
set(BUILD_OPENJPEG TRUE)
......
## About
dcm2niix attempts to convert UIH DICOM format images to NIfTI.
## Notes
Shan C Young provided the [following information](https://github.com/rordenlab/dcm2niix/issues/225), which is used by dcm2niix to generate NIfTI and BIDS format files.
UIH supports two ways of archiving the DWI/DTI and fMRI data. One way is one DICOM file per slice and the other is one dicom file per volume (UIH refers to this as GRID format, similar to the Siemens Mosaic format). The private tags used in the images are shown in the following table.
Tag ID | Tag Name | VR | VM | Description | Sample
-- | -- | -- | -- | -- | --
0061,1002 | Generate Private | US | 1 | Flag to generate private format file | 1
**0061,4002** | **FOV** | SH | 1 | FOV(mm) | 224*224
0065,1000 | MeasurmentUID | UL | 1 | Measurement UID of Protocol | 12547865
0065,1002 | ImageOrientationDisplayed | SH | 1 | Image Orientation Displayed | Sag or Sag>Cor
0065,1003 | ReceiveCoil | LO | 1 | Receive Coil Information | H 8
0065,1004 | Interpolation | SH | 1 | Interpolation | I
0065,1005 | PE Direction Displayed | SH | 1 | Phase encoding diretion displayed | A->P or H->F
0065,1006 | Slice Group ID | IS | 1 | Slice Group ID | 1
0065,1007 | Uprotocol | OB | 1 | Uprotocol value |
0065,1009 | BActualValue | FD | 1 | Actual B-Value from sequence | 1000.0
**0065,100A** | **BUserValue** | FD | 1 | User Choose B-Value from UI | 1000.0
**0065,100B** | **Block Size** | DS | 1 | Size of the paradigm/block | 10
**0065,100C** | **Experimental status** | SH | 1 | fMRI | rest/active
0065,100D | Parallel Information | SH | 1 | ratio of parallel acquisition and acceleration |
0065,100F | Slice Position | SH | 1 | Slice location displayed on the screen | H23.4
0065,1011 | Sections | SH | 1 | |
0065,1013 | InPlaneRotAngle | FD(°) | 1 | Rotation angle in the plane | -0.5936
0065,1014 | SliceNormalVector | DS | 3 | Normal vector of the slice | 0\0\1
0065,1015 | SliceCenterPosition | DS | 3 | Center position of the slice | 0\0\0
0065,1016 | PixelRotateModel | UL | 1 | Pixel Rotation Model | 4
0065,1017 | SAR Model | LO | 1 | Calculation model of SAR value | Normal:WHBST
0065,1018 | dB/dt Model | LO | 1 | Calculation model of dB/dt | Normal
0065,1023 | TablePosition | LO | 1 | Table Position | 0
0065,1025 | Slice Gap | DS | 1 | Slice Gap | 0.0
0065,1029 | AcquisitionDuration | SH | 1 | Acquisition Duration | 0.03
0065,102B | ApplicationCategory | LT | 1 | Application names available | DTI\Func
0065,102C | RepeatitionIndex | IS | 1 | | 0
**0065,102D** | **SequenceDisplayName** | ST | 1 | Sequence display name | Epi_dti_b0
0065,102E | NoiseDecovarFlag | LO | 1 | Noise decorrelation flag | PreWhite
0065,102F | ScaleFactor | FL | 1 | scale factor | 2.125
0065,1031 | MRSequenceVariant | SH | 1 | SequenceVariant |
0065,1032 | MRKSpaceFilter | SH | 1 | K space filter |
0065,1033 | MRTableMode | SH | 1 | Table mode | Fix
0065,1036 | MRDiscoParameter | OB | 1 | |
**0065,1037** | **MRDiffusionGradOrientation** | FD | 3 | Diffusion gradient orientation | 0\0\0
0065,1038 | MRPerfusionNoiseLevel | FD | 1 | epi_dwi/perfusion noise level | 40
0065,1039 | MRGradRange | SH | 6 | linear range of gradient | 0.0\157\0.0\157\0.0\125
**0065,1050** | **MR Number Of Slice In Volume** | DS | 1 | Number Of Frames In a Volume,Columns of each frame: cols =ceil(sqrt(total)) ; Rows of each frame: rows =ceil(total/cols) ; appeared when image type (00080008) has VFRAME | 27
0065,1051 | MR VFrame Sequence | SQ | 1 | 1 |
->0008,0022 | Acquisition Date | DA | 1 | |
->0008,0032 | Acquisition Time | TM | 1 | |
->0008,002A | Acquisition DateTime | DT | 1 | |
->0020,0032 | ImagePosition(Patient) | DS | 3 | |
->00201041 | Slice Location | DS | 1 | |
->0018,9073 | Acquisition Duration | FD | 1 | |
->0065,100C | MRExperimental Status | SH | 1 | | rest/active
## Sample Datasets
- [UIH has provided a reference dataset](https://1drv.ms/f/s!Avf7THyflzj1gnO37GL2I8Hk-0MV).
- [A validation dataset for dcm2niix commits](https://github.com/neurolabusc/dcm_qa_uih).
\ No newline at end of file
## Versions
14-November-2018
- [GE images provide more BIDS tags](https://github.com/rordenlab/dcm2niix/issues/163).
- [Bruker enhanced DICOM support](https://github.com/rordenlab/dcm2niix/issues/241).
- [Siemens Vida XA10 support](https://github.com/rordenlab/dcm2niix/issues/240). Note that Vida DICOM data is crippled [if the user exports as mosaics or anonymized/reduced](https://github.com/rordenlab/dcm2niix/issues/236).
- [UIH enhanced DICOM support](https://github.com/rordenlab/dcm2niix/issues/225).
- New DICOM [renaming](RENAMING.md) feature.
22-June-2018
- [fix issues where 6-June-2018 release could save Enhanced DICOM Philips bvec/bval with different order than .nii images](https://github.com/rordenlab/dcm2niix/issues/201).
- [Fix issues where 6-June-2018 release could save Enhanced DICOM Philips bvec/bval with different order than .nii images](https://github.com/rordenlab/dcm2niix/issues/201).
6-June-2018
- [Improved Philips PAR/REC support](https://github.com/rordenlab/dcm2niix/issues/171)
......
......@@ -142,6 +142,7 @@ unsigned char * decode_JPEG_SOF_0XC3 (const char *fn, int skipBytes, bool verbo
uint16_t SOFxdim = 0;
// long SOSarrayPos; //SOFarrayPos
int lnHufTables = 0;
int lFrameCount = 1;
const int kmaxFrames = 4;
struct HufTables l[kmaxFrames+1];
do { //read each marker in the header
......@@ -180,7 +181,6 @@ unsigned char * decode_JPEG_SOF_0XC3 (const char *fn, int skipBytes, bool verbo
}
} else if (btMarkerType == 0xC4) {//if SOF marker else if define-Huffman-tables marker (DHT)
if (verbose) printMessage(" [Huffman Length %d]\n", lSegmentLength);
int lFrameCount = 1;
do {
uint8_t DHTnLi = readByte(lRawRA, &lRawPos, lRawSz ); //we read but ignore DHTtcth.
#pragma unused(DHTnLi) //we need to increment the input file position, but we do not care what the value is
......@@ -325,8 +325,9 @@ unsigned char * decode_JPEG_SOF_0XC3 (const char *fn, int skipBytes, bool verbo
} //For each frame, e.g. once each for Red/Green/Blue
//NEXT: some RGB images use only a single Huffman table for all 3 colour planes. In this case, replicate the correct values
if (lnHufTables < SOFnf) { //use single Hufman table for each frame
for (int lFrameCount = 2; lFrameCount <= SOFnf; lFrameCount++) {
l[lFrameCount] = l[1];
for (int lFrameCount = lnHufTables+1; lFrameCount <= SOFnf; lFrameCount++) {
l[lFrameCount] = l[lnHufTables];
} //for each frame
} // if lnHufTables < SOFnf
//NEXT: uncompress data: different loops for different predictors
......
......@@ -85,7 +85,7 @@ void showHelp(const char * argv[], struct TDCMopts opts) {
#else
#define kQstr ""
#endif
printf(" -f : filename (%%a=antenna (coil) number, %%c=comments, %%d=description, %%e=echo number, %%f=folder name, %%i=ID of patient, %%j=seriesInstanceUID, %%k=studyInstanceUID, %%m=manufacturer, %%n=name of patient, %%p=protocol,%s %%s=series number, %%t=time, %%u=acquisition number, %%v=vendor, %%x=study ID; %%z=sequence name; default '%s')\n", kQstr, opts.filename);
printf(" -f : filename (%%a=antenna (coil) name, %%b=basename, %%c=comments, %%d=description, %%e=echo number, %%f=folder name, %%i=ID of patient, %%j=seriesInstanceUID, %%k=studyInstanceUID, %%m=manufacturer, %%n=name of patient, %%p=protocol,%s %%r=instance number, %%s=series number, %%t=time, %%u=acquisition number, %%v=vendor, %%x=study ID; %%z=sequence name; default '%s')\n", kQstr, opts.filename);
printf(" -g : generate defaults file (y/n/o/i [o=only: reset and write defaults; i=ignore: reset defaults], default n)\n");
printf(" -h : show help\n");
printf(" -i : ignore derived, localizer and 2D images (y/n, default n)\n");
......@@ -96,6 +96,7 @@ void showHelp(const char * argv[], struct TDCMopts opts) {
printf(" -n : only convert this series number - can be used up to %i times (default convert all)\n", MAX_NUM_SERIES);
printf(" -o : output directory (omit to save to input folder)\n");
printf(" -p : Philips precise float (not display) scaling (y/n, default y)\n");
printf(" -r : rename instead of convert DICOMs (y/n, default n)\n");
printf(" -s : single file mode, do not convert other images in folder (y/n, default n)\n");
printf(" -t : text notes includes private patient details (y/n, default n)\n");
#if !defined(_WIN64) && !defined(_WIN32) //shell script for Unix only
......@@ -273,7 +274,7 @@ int main(int argc, const char * argv[])
isSaveIni = true;
if (((argv[i][0] == 'i') || (argv[i][0] == 'I')) && (!isResetDefaults)) {
isResetDefaults = true;
printf("Defaults reset\n");
printf("Defaults ignored\n");
setDefaultOpts(&opts, argv);
i = 0; //re-read all settings for this pass, e.g. "dcm2niix -f %p_%s -d o" should save filename as "%p_%s"
}
......@@ -314,7 +315,11 @@ int main(int argc, const char * argv[])
opts.isPhilipsFloatNotDisplayScaling = false;
else
opts.isPhilipsFloatNotDisplayScaling = true;
} else if ((argv[i][1] == 'r') && ((i+1) < argc)) {
i++;
if (invalidParam(i, argv)) return 0;
if ((argv[i][0] == 'y') || (argv[i][0] == 'Y'))
opts.isRenameNotConvert = true;
} else if ((argv[i][1] == 's') && ((i+1) < argc)) {
i++;
if (invalidParam(i, argv)) return 0;
......
......@@ -31,7 +31,7 @@
#include "print.h"
#ifndef HAVE_R
#ifndef USING_R
void nifti_swap_8bytes( size_t n , void *ar ) // 4 bytes at a time
{
size_t ii ;
......@@ -192,7 +192,7 @@ mat44 nifti_dicom2mat(float orient[7], float patientPosition[4], float xyzMM[4])
return Q44;
}
#ifndef HAVE_R
#ifndef USING_R
float nifti_mat33_determ( mat33 R ) /* determinant of 3x3 matrix */
{
double r11,r12,r13,r21,r22,r23,r31,r32,r33 ;
......@@ -239,7 +239,7 @@ mat33 nifti_mat33_transpose( mat33 A ) /* transpose 3x3 matrix */
return B;
}
#ifndef HAVE_R
#ifndef USING_R
mat33 nifti_mat33_inverse( mat33 R ) /* inverse of 3x3 matrix */
{
double r11,r12,r13,r21,r22,r23,r31,r32,r33 , deti ;
......
......@@ -4,7 +4,7 @@
#ifndef _NIFTI_IO_CORE_HEADER_
#define _NIFTI_IO_CORE_HEADER_
#ifdef HAVE_R
#ifdef USING_R
#define STRICT_R_HEADERS
#include "RNifti.h"
#endif
......@@ -17,7 +17,7 @@ extern "C" {
#include <string.h>
#ifndef HAVE_R
#ifndef USING_R
typedef struct { /** 4x4 matrix struct **/
float m[3][3] ;
} mat33 ;
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
#include <string.h>
#include <stdint.h>
#include "nifti1_io_core.h"
#ifndef HAVE_R
#ifndef USING_R
#include "nifti1.h"
#endif
......@@ -43,7 +43,7 @@ extern "C" {
#define kCCsuf " CompilerNA" //unknown compiler!
#endif
#define kDCMvers "v1.0.20180622" kJP2suf kLSsuf kCCsuf
#define kDCMvers "v1.0.20181125 " kJP2suf kLSsuf kCCsuf
static const int kMaxEPI3D = 1024; //maximum number of EPI images in Siemens Mosaic
static const int kMaxDTI4D = 18000; //maximum number of DTI directions for 4D (Philips) images, also maximum number of 3D slices for Philips 3D and 4D images
......@@ -56,6 +56,8 @@ static const int kMaxSlice2D = 64000; //maximum number of 2D slices in 4D (Phili
#define kMANUFACTURER_GE 2
#define kMANUFACTURER_PHILIPS 3
#define kMANUFACTURER_TOSHIBA 4
#define kMANUFACTURER_UIH 5
#define kMANUFACTURER_BRUKER 6
//note: note a complete modality list, e.g. XA,PX, etc
#define kMODALITY_UNKNOWN 0
......@@ -66,11 +68,16 @@ static const int kMaxSlice2D = 64000; //maximum number of 2D slices in 4D (Phili
#define kMODALITY_US 5
//GE phase encoding
#define kGE_PHASE_DIRECTION_UNKNOWN 0
#define kGE_PHASE_DIRECTION_BOTTOM_UP 1
#define kGE_PHASE_DIRECTION_TOP_DOWN 2
#define kGE_PHASE_DIRECTION_CENTER_OUT_REV 3
#define kGE_PHASE_DIRECTION_CENTER_OUT 4
#define kGE_PHASE_ENCODING_POLARITY_UNKNOWN -1
#define kGE_PHASE_ENCODING_POLARITY_UNFLIPPED 0
#define kGE_PHASE_ENCODING_POLARITY_FLIPPED 4
#define kGE_SLICE_ORDER_UNKNOWN -1
#define kGE_SLICE_ORDER_TOP_DOWN 0
#define kGE_SLICE_ORDER_BOTTOM_UP 2
//#define kGE_PHASE_DIRECTION_CENTER_OUT_REV 3
//#define kGE_PHASE_DIRECTION_CENTER_OUT 4
#define kEXIT_NO_VALID_FILES_FOUND 2
static const int kSliceOrientUnknown = 0;
......@@ -98,7 +105,6 @@ static const int kCompressJPEGLS = 5; //LoCo JPEG-LS
// Maximum number of dimensions for .dimensionIndexValues, i.e. possibly the
// number of axes in the output .nii.
static const uint8_t MAX_NUMBER_OF_DIMENSIONS = 8;
struct TDTI {
float V[4];
//int totalSlicesIn4DOrder;
......@@ -149,31 +155,27 @@ static const uint8_t MAX_NUMBER_OF_DIMENSIONS = 8;
struct TDICOMdata {
long seriesNum;
int xyzDim[5];
//numberOfDynamicScans, patientPositionNumPhilips
//patientPositionSequentialRepeats,patientPositionRepeats,
//maxGradDynVol, gradDynVol,
int phaseEncodingGE, protocolBlockStartGE, protocolBlockLengthGE, modality, dwellTime, effectiveEchoSpacingGE, phaseEncodingLines, phaseEncodingSteps, echoTrainLength, coilNum, echoNum, sliceOrient, manufacturer, converted2NII, acquNum, imageNum, imageStart, imageBytes, bitsStored, bitsAllocated, samplesPerPixel,locationsInAcquisition, compressionScheme;
float patientWeight, zSpacing, zThick, pixelBandwidth, SAR, phaseFieldofView, accelFactPE, flipAngle, fieldStrength, TE, TI, TR, intenScale, intenIntercept, intenScalePhilips, gantryTilt, lastScanLoc, angulation[4];
uint32_t coilCrc;
int numberOfImagesInGridUIH, numberOfDiffusionDirectionGE, phaseEncodingGE, protocolBlockStartGE, protocolBlockLengthGE, modality, dwellTime, effectiveEchoSpacingGE, phaseEncodingLines, phaseEncodingSteps, echoTrainLength, echoNum, sliceOrient, manufacturer, converted2NII, acquNum, imageNum, imageStart, imageBytes, bitsStored, bitsAllocated, samplesPerPixel,locationsInAcquisition, compressionScheme;
float imagingFrequency, patientWeight, zSpacing, zThick, pixelBandwidth, SAR, phaseFieldofView, accelFactPE, flipAngle, fieldStrength, TE, TI, TR, intenScale, intenIntercept, intenScalePhilips, gantryTilt, lastScanLoc, angulation[4];
float orient[7], patientPosition[4], patientPositionLast[4], xyzMM[4], stackOffcentre[4];
float radionuclidePositronFraction, radionuclideTotalDose, radionuclideHalfLife, doseCalibrationFactor; //PET ISOTOPE MODULE ATTRIBUTES (C.8-57)
float rtia_timerGE, radionuclidePositronFraction, radionuclideTotalDose, radionuclideHalfLife, doseCalibrationFactor; //PET ISOTOPE MODULE ATTRIBUTES (C.8-57)
float ecat_isotope_halflife, ecat_dosage;
double triggerDelayTime, RWVScale, RWVIntercept, dateTime, acquisitionTime, acquisitionDate, bandwidthPerPixelPhaseEncode;
//char mrAcquisitionType[kDICOMStr]
char scanOptions[kDICOMStr], stationName[kDICOMStr], softwareVersions[kDICOMStr], deviceSerialNumber[kDICOMStr], institutionAddress[kDICOMStr], institutionName[kDICOMStr], referringPhysicianName[kDICOMStr], seriesInstanceUID[kDICOMStr], studyInstanceUID[kDICOMStr], bodyPartExamined[kDICOMStr], procedureStepDescription[kDICOMStr], imageType[kDICOMStr], institutionalDepartmentName[kDICOMStr], manufacturersModelName[kDICOMStr], patientID[kDICOMStr], patientOrient[kDICOMStr], patientName[kDICOMStr],seriesDescription[kDICOMStr], studyID[kDICOMStr], sequenceName[kDICOMStr], protocolName[kDICOMStr],sequenceVariant[kDICOMStr],scanningSequence[kDICOMStr], patientBirthDate[kDICOMStr], patientAge[kDICOMStr], studyDate[kDICOMStr],studyTime[kDICOMStr];
double acquisitionDuration, triggerDelayTime, RWVScale, RWVIntercept, dateTime, acquisitionTime, acquisitionDate, bandwidthPerPixelPhaseEncode;
char coilElements[kDICOMStr], coilName[kDICOMStr], phaseEncodingDirectionDisplayedUIH[kDICOMStr], imageBaseName[kDICOMStr], scanOptions[kDICOMStr], stationName[kDICOMStr], softwareVersions[kDICOMStr], deviceSerialNumber[kDICOMStr], institutionAddress[kDICOMStr], institutionName[kDICOMStr], referringPhysicianName[kDICOMStr], seriesInstanceUID[kDICOMStr], studyInstanceUID[kDICOMStr], bodyPartExamined[kDICOMStr], procedureStepDescription[kDICOMStr], imageType[kDICOMStr], institutionalDepartmentName[kDICOMStr], manufacturersModelName[kDICOMStr], patientID[kDICOMStr], patientOrient[kDICOMStr], patientName[kDICOMStr],seriesDescription[kDICOMStr], studyID[kDICOMStr], sequenceName[kDICOMStr], protocolName[kDICOMStr],sequenceVariant[kDICOMStr],scanningSequence[kDICOMStr], patientBirthDate[kDICOMStr], patientAge[kDICOMStr], studyDate[kDICOMStr],studyTime[kDICOMStr];
char imageComments[kDICOMStrLarge];
uint32_t dimensionIndexValues[MAX_NUMBER_OF_DIMENSIONS];
struct TCSAdata CSA;
//isSlicesSpatiallySequentialPhilips
bool isSegamiOasis, isScaleOrTEVaries, isDerived, isXRay, isMultiEcho, isValid, is3DAcq, is2DAcq, isExplicitVR, isLittleEndian, isPlanarRGB, isSigned, isHasPhase, isHasImaginary, isHasReal, isHasMagnitude,isHasMixed, isFloat, isResampled, isLocalizer;
bool isCoilVaries, isNonParallelSlices, isSegamiOasis, isXA10A, isScaleOrTEVaries, isDerived, isXRay, isMultiEcho, isValid, is3DAcq, is2DAcq, isExplicitVR, isLittleEndian, isPlanarRGB, isSigned, isHasPhase, isHasImaginary, isHasReal, isHasMagnitude,isHasMixed, isFloat, isResampled, isLocalizer;
char phaseEncodingRC, patientSex;
//uint32_t *totalSlicesIn4DOrder; //Reordering array for Philips slices
};
size_t nii_ImgBytes(struct nifti_1_header hdr);
int isSameFloatGE (float a, float b);
void getFileName( char *pathParent, const char *path);
struct TDICOMdata readDICOMv(char * fname, int isVerbose, int compressFlag, struct TDTI4D *dti4D);
struct TDICOMdata readDICOM(char * fname);
struct TDICOMdata clear_dicom_data();
struct TDICOMdata clear_dicom_data(void);
struct TDICOMdata nii_readParRec (char * parname, int isVerbose, struct TDTI4D *dti4D, bool isReadPhase);
unsigned char * nii_flipY(unsigned char* bImg, struct nifti_1_header *h);
unsigned char * nii_flipZ(unsigned char* bImg, struct nifti_1_header *h);
......
This diff is collapsed.
......@@ -10,12 +10,12 @@ extern "C" {
#include <stdbool.h> //requires VS 2015 or later
#include <string.h>
#ifndef HAVE_R
#ifndef USING_R
#include "nifti1.h"
#endif
#include "nii_dicom.h"
#ifdef HAVE_R
#ifdef USING_R
struct TDicomSeries {
TDICOMdata representativeData;
std::vector<std::string> files;
......@@ -25,12 +25,12 @@ extern "C" {
#define MAX_NUM_SERIES 16
struct TDCMopts {
bool isMaximize16BitRange, isSave3D,isGz, isFlipY, isCreateBIDS, isSortDTIbyBVal, isAnonymizeBIDS, isOnlyBIDS, isCreateText, isIgnoreDerivedAnd2D, isPhilipsFloatNotDisplayScaling, isTiltCorrect, isRGBplanar, isOnlySingleFile, isForceStackSameSeries, isCrop;
bool isRenameNotConvert, isMaximize16BitRange, isSave3D,isGz, isFlipY, isCreateBIDS, isSortDTIbyBVal, isAnonymizeBIDS, isOnlyBIDS, isCreateText, isIgnoreDerivedAnd2D, isPhilipsFloatNotDisplayScaling, isTiltCorrect, isRGBplanar, isOnlySingleFile, isForceStackSameSeries, isCrop;
int isVerbose, compressFlag, dirSearchDepth, gzLevel; //support for compressed data 0=none,
char filename[512], outdir[512], indir[512], pigzname[512], optsname[512], indirParent[512], imageComments[24];
float seriesNumber[MAX_NUM_SERIES];
long numSeries;
#ifdef HAVE_R
#ifdef USING_R
bool isScanOnly;
void *imageList;
std::vector<TDicomSeries> series;
......
#ifndef HAVE_R
#ifndef USING_R
#include "nifti1.h"
#endif
#include "nifti1_io_core.h"
......