Skip to content

Commit

Permalink
Fix for #124
Browse files Browse the repository at this point in the history
  • Loading branch information
neurolabusc committed Aug 30, 2017
1 parent d54cf68 commit dd1d994
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ This requires a compiler that supports c++11.

## Links

- [Dcm2Bids](https://github.com/cbedetti/Dcm2Bids) uses dcm2niix to create [BIDS](http://bids.neuroimaging.io/) datasets.
- [Dcm2Bids](https://github.com/cbedetti/Dcm2Bids) uses dcm2niix to create [BIDS](http://bids.neuroimaging.io/) datasets.
- [bidskit](https://github.com/jmtyszka/bidskit) uses dcm2niix to create [BIDS](http://bids.neuroimaging.io/) datasets.
- [DAC2BIDS](https://github.com/dangom/dac2bids) uses dcm2niibatch to create [BIDS](http://bids.neuroimaging.io/) datasets.
- [heudiconv](https://github.com/nipy/heudiconv) can use dcm2niix to create [BIDS](http://bids.neuroimaging.io/) datasets.
- [nipype](https://github.com/nipy/nipype) can use dcm2niix to convert images.
- [pydcm2niix is a Python module for working with dcm2niix](https://github.com/jstutters/pydcm2niix).
Expand Down
11 changes: 11 additions & 0 deletions console/nii_dicom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2697,6 +2697,7 @@ struct TDICOMdata readDICOMv(char * fname, int isVerbose, int compressFlag, stru
#define kComplexImageComponent (uint32_t) 0x0008+(0x9208 << 16 )//'0008' '9208' 'CS' 'ComplexImageComponent'
#define kPatientName 0x0010+(0x0010 << 16 )
#define kPatientID 0x0010+(0x0020 << 16 )
#define kAnatomicalOrientationType 0x0010+(0x2210 << 16 )
#define kBodyPartExamined 0x0018+(0x0015 << 16)
#define kScanningSequence 0x0018+(0x0020 << 16)
#define kSequenceVariant 0x0018+(0x0021 << 16)
Expand Down Expand Up @@ -2765,6 +2766,9 @@ struct TDICOMdata readDICOMv(char * fname, int isVerbose, int compressFlag, stru
#define kCoilSiemens 0x0051+(0x100F << 16 )
#define kImaPATModeText 0x0051+(0x1011 << 16 )
#define kLocationsInAcquisition 0x0054+(0x0081 << 16 )
//ftp://dicom.nema.org/MEDICAL/dicom/2014c/output/chtml/part03/sect_C.8.9.4.html
//If ImageType is REPROJECTION we slice direction is reversed - need example to test
// #define kSeriesType 0x0054+(0x1000 << 16 )
#define kDoseCalibrationFactor 0x0054+(0x1322<< 16 )
#define kIconImageSequence 0x0088+(0x0200 << 16 )
#define kDiffusionBFactor 0x2001+(0x1003 << 16 )// FL
Expand Down Expand Up @@ -3054,6 +3058,13 @@ struct TDICOMdata readDICOMv(char * fname, int isVerbose, int compressFlag, stru
case kPatientName :
dcmStr (lLength, &buffer[lPos], d.patientName);
break;
case kAnatomicalOrientationType: {
char aotTxt[kDICOMStr]; //ftp://dicom.nema.org/MEDICAL/dicom/2015b/output/chtml/part03/sect_C.7.6.2.html#sect_C.7.6.2.1.1
dcmStr (lLength, &buffer[lPos], aotTxt);
int slen = (int) strlen(aotTxt);
if((slen < 9) || (strstr(aotTxt, "QUADRUPED") == NULL) ) break;
printError("Anatomical Orientation Type (0010,2210) is QUADRUPED: rotate coordinates accordingly");
break; }
case kPatientID :
dcmStr (lLength, &buffer[lPos], d.patientID);
break;
Expand Down
14 changes: 11 additions & 3 deletions console/nii_dicom_batch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1509,10 +1509,18 @@ int nii_saveNII(char * niiFilename, struct nifti_1_header hdr, unsigned char* im
return EXIT_FAILURE;
}
#define kMaxPigz 3758096384
//https://stackoverflow.com/questions/5272825/detecting-64bit-compile-in-c
#if UINTPTR_MAX == 0xffffffff
#define kMaxGz 2147483647
#elif UINTPTR_MAX == 0xffffffffffffffff
#define kMaxGz kMaxPigz
#else
compiler error: unable to determine is 32 or 64 bit
#endif
#ifndef myDisableZLib
if ((opts.isGz) && (strlen(opts.pigzname) < 1) && ((imgsz+hdr.vox_offset) >= 2147483647) ) { //use internal compressor
printWarning("Saving uncompressed data: internal compressor limited to 2Gb images.\n");
if ((imgsz+hdr.vox_offset) < 3758096384)
if ((opts.isGz) && (strlen(opts.pigzname) < 1) && ((imgsz+hdr.vox_offset) >= kMaxGz) ) { //use internal compressor
printWarning("Saving uncompressed data: internal compressor limited to %d bytes images.\n", kMaxGz);
if ((imgsz+hdr.vox_offset) < kMaxPigz)
printWarning(" Hint: using external compressor (pigz) should help.\n");
} else if ((opts.isGz) && (strlen(opts.pigzname) < 1) && ((imgsz+hdr.vox_offset) < 2147483647) ) { //use internal compressor
writeNiiGz (niiFilename, hdr, im, imgsz, opts.gzLevel);
Expand Down

0 comments on commit dd1d994

Please sign in to comment.