Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Philips PARREC conversion for long multiband BOLD crashes #460

Closed
ZieroNLD opened this issue Dec 10, 2020 · 6 comments
Closed

Philips PARREC conversion for long multiband BOLD crashes #460

ZieroNLD opened this issue Dec 10, 2020 · 6 comments

Comments

@ZieroNLD
Copy link

ZieroNLD commented Dec 10, 2020

Dear dcm2niix team,

Was trying to convert Philips PARREC conversion for long multiband BOLD fMRI series (15min)
unfortunately dcm2niix crashes with the following error message
This is the case for both versions v1.0.20200427 and v1.0.20200331, but an older version does work! (v1.0.20190902 )

Would be great to resolve this

My best,
Jeroen

FAILS to CONVERT

dcm2niix -z y -b y -f %p_%s test
Chris Rorden's dcm2niiX version v1.0.20200427 (JP2:OpenJPEG) GCC8.3.0 (64-bit Linux)
Found 1 DICOM file(s)
Warning: dcm2niix PAR is not actively supported (hint: use dicm2nii)
Warning: PAR/REC intensity scaling varies between slices (please validate output).
Warning: Expected 1033193494 slices, but found 51 (1..51). test/SUBJNAME^M.B^^^_BOLD_MB_ACZ_15min_7_1.PAR
Warning: Reported TR=0.0728914ms, measured TR=1050ms (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 43350 slices
Error: Unable to convert DTI [increase kMaxDTI4D] found 1033193494 directions
*** stack smashing detected ***: terminated
Aborted

THIS WORKS

dcm2niix20190902 -z y -b y -f %p_%s test
Chris Rorden's dcm2niiX version v1.0.20190902 (JP2:OpenJPEG) (JP-LS:CharLS) GCC5.5.0 (64-bit Linux)
Found 1 DICOM file(s)
Warning: dcm2niix PAR is not actively supported (hint: use dicm2nii)
Warning: PAR file volumes not saved in ascending temporal order (please check re-ordering)
Done reading PAR header version 4.2, with 43350 slices
Philips Scaling Values RS:RI:SS = 0.82247:0:0.0728914 (see PMC3998685)
Convert 1 DICOM as test/BOLDMBACZ15min_7 (96x96x51x850)
Compress: "/usr/bin/pigz" -b 960 -n -f -6 "test/BOLDMBACZ15min_7.nii"
Conversion required 14.560835 seconds (7.389468 for core code).

@neurolabusc
Copy link
Collaborator

See my comments for issue 461

@neurolabusc
Copy link
Collaborator

If you edit nit_dicom.h and change the line

static const int kMaxDTI4D = 18000; 

to read

static const int kMaxDTI4D = 65000; 

and recompile, does it work with your dataset?

At the moment, this structure is created on the stack, and setting a large value may cause issues for some compilers on the Windows operating system. Large values are really only used for the new PAR/REC unscrambling. If this resolves your issue, this could be created dynamically on the heap instead. When dcm2niix was designed, DICOMs were 2D images. The modern era of enhanced DICOM and multi-band do require making some of these dynamic arrays.

@ZieroNLD
Copy link
Author

ZieroNLD commented Dec 11, 2020 via email

@drmclem
Copy link

drmclem commented Dec 11, 2020

HI

I would have thought that this was the problem

Expected 1033193494 slices, but found 51 (1..51).

That number looks very wrong.

Matthew

neurolabusc added a commit that referenced this issue Dec 11, 2020
@neurolabusc
Copy link
Collaborator

This should be fixed. The latest commit can convert PAR/REC slices with up to 64000 slices, if this is exceeded it will ask you to recompile after increasing kMaxSlice2D in nii_dicom.h. Information is now stored on the heap instead of the stack, so the only consequence of increasing this value will be that dcm2niix will use a bit more RAM. In the future, this can be extended to dynamically increase, similar to what we do with 2D slices.

@drmclem
Copy link

drmclem commented Dec 15, 2020

For info - the maximum (currently) number of slices on Philips for 1 single scan enitiy is 65535.

M

yarikoptic added a commit to neurodebian/dcm2niix that referenced this issue Apr 6, 2021
* commit 'v1.0.20200427-97-g0587941': (22 commits)
  Overflow for Siemens data [missing protocol name] (rordenlab#466)
  MacOS notarization, minor tweaks
  Increase details for series stacking, enhance merge override mode (rordenlab#463)
  Bump version date
  Retain Philips Scaling Values for images where scaling does not vary but volumes must be separated (rordenlab#461)
  Support huge PAR/REC files (rordenlab#460)
  Prevent dti4D overflow
  Fix PAR/REC ADC detection (rordenlab#462)
  DICOM field map calibrated in Hz given name _fieldmaphz (rordenlab#455)
  PAR/REC field map calibrated in Hz given name _fieldmaphz (rordenlab#455)
  Ignore LocationsInAcquisition (0020,1002) if number of slices is not evenly divisible with this value (rordenlab#459)
  Convert DICOM series where bit allocated (0028,0100) varies across slices (rordenlab#458)
  Clear RepetitionTimeExcitation (rordenlab#457)
  leak (rordenlab#454)
  Single file mode memory allocation (rordenlab#454)
  When -n is specified, only save BIDS for requested series (rordenlab#453)
  Use 1st study time if multiple times provided.
  Apple. M1. use C++ not. C
  Fix CMake for Apple Silicon (note similar change required for CloudFlare zlib)
  Only report b-value for GE data with 0043,1039 if EPI (0018,9018) (rordenlab#449)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants