Hello, I've ran into a bad thing in ImageMagick. Version is 6.6.0-6, OS - Ubuntu 9.10.
I use:
convert <dicom-file> -resize 64x64 <jpeg file>
to transform DICOM-file into jpeg, and it sticks. DICOM is MONOCHROME2, 4-bytes per pixel.
The same happens if to use Image "read"/"write" from magick++ for the dicom-file.
But the most bad is that the conversion it not only hangs but allocates more and more memory continiously.
I checked the same file on Fedora 9+ImageMagick 5.5.7 and it works, creates black thumbnail instead of a picture, but doesn't fail or stick.
Question: am I doing something wrong or the latest IM versions don't support such type of DICOM-files ?
Thanks in advance.
very bad bug in 6.6.0-6 with DICOM
Re: very bad bug in 6.6.0-6 with DICOM
One of the failed images: http://uploading.com/files/15m638a1/111.dcm/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: very bad bug in 6.6.0-6 with DICOM
I downloaded your file. I know nothing about dcm images. I checked my system (IM 6.6.1-0 beta) and
convert -list format
shows
DCM* DCM r--
so supposedly read only. I then tried
identify -verbose 111.dcm
identify: memory allocation failed `111.dcm' @ error/dcm.c/ReadDCMImage/3590.
I am not sure if I need some delegate library or not.
Might your file be corrupt?
Opening it in GraphicsConverter shows a completely black image. Photoshop will not open it.
Only ImageJ seems to be able to open it successfully and show something reasonable --- basically a black image with a fuzzy white center area.
convert -list format
shows
DCM* DCM r--
so supposedly read only. I then tried
identify -verbose 111.dcm
identify: memory allocation failed `111.dcm' @ error/dcm.c/ReadDCMImage/3590.
I am not sure if I need some delegate library or not.
Might your file be corrupt?
Opening it in GraphicsConverter shows a completely black image. Photoshop will not open it.
Only ImageJ seems to be able to open it successfully and show something reasonable --- basically a black image with a fuzzy white center area.
Last edited by fmw42 on 2010-03-31T11:59:27-07:00, edited 3 times in total.
Re: very bad bug in 6.6.0-6 with DICOM
No, you don't need a delegate library, it was ever supported in ImageMagick. And the file is not corrupted, viewers open it, you may use ImageJ for example.
Identify from IM 5.5.7 gives:
./111.dcm DCM 211x179+0+0 PseudoClass 65536c 16-bit 153.3kb 0.010u 0:01
Yes, your picture in ImageJ is correct.
Identify from IM 5.5.7 gives:
./111.dcm DCM 211x179+0+0 PseudoClass 65536c 16-bit 153.3kb 0.010u 0:01
Yes, your picture in ImageJ is correct.
Last edited by L F on 2010-03-31T12:01:12-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: very bad bug in 6.6.0-6 with DICOM
Yes, ImageJ does work. And I get from IM the same error on a simple identify
identify 111.dcm
identify: memory allocation failed `111.dcm' @ error/dcm.c/ReadDCMImage/3590.
identify 111.dcm
identify: memory allocation failed `111.dcm' @ error/dcm.c/ReadDCMImage/3590.
Re: very bad bug in 6.6.0-6 with DICOM
I've compared different IM versions and Fedora vs Ubuntu and result is: the latest (at least 6.5 and 6.6) IMs doesn't read DICOM files with 4 bytes per pixel. The only IM 5.5.7 does it, maybe not too correctly but without errors and sticking.
Question: is it possible to define depth somehow before reading into Image from a file as:
fileIn.read(file_name);
if it can help with the above file?
Thanks.
Question: is it possible to define depth somehow before reading into Image from a file as:
fileIn.read(file_name);
if it can help with the above file?
Thanks.
Re: very bad bug in 6.6.0-6 with DICOM
Possibly this very code in ImageMagick causes the problem: coders/dcm.c :
...
Quantum *scale
...
if (image->depth != (1UL*MAGICKCORE_QUANTUM_DEPTH))
.....
length=(size_t) (GetQuantumRange(image->depth)+1);
scale=(Quantum *) AcquireQuantumMemory(length,sizeof(*scale)); !!!!!!!!!!
if (scale == (Quantum *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
......
...
Quantum *scale
...
if (image->depth != (1UL*MAGICKCORE_QUANTUM_DEPTH))
.....
length=(size_t) (GetQuantumRange(image->depth)+1);
scale=(Quantum *) AcquireQuantumMemory(length,sizeof(*scale)); !!!!!!!!!!
if (scale == (Quantum *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
......