Page 1 of 1
very bad bug in 6.6.0-6 with DICOM
Posted: 2010-03-31T11:41:33-07:00
by L F
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.
Re: very bad bug in 6.6.0-6 with DICOM
Posted: 2010-03-31T11:44:46-07:00
by L F
Re: very bad bug in 6.6.0-6 with DICOM
Posted: 2010-03-31T11:52:52-07:00
by fmw42
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.
Re: very bad bug in 6.6.0-6 with DICOM
Posted: 2010-03-31T11:54:24-07:00
by L F
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.
Re: very bad bug in 6.6.0-6 with DICOM
Posted: 2010-03-31T12:00:40-07:00
by fmw42
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.
Re: very bad bug in 6.6.0-6 with DICOM
Posted: 2010-04-01T12:31:03-07:00
by L F
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.
Re: very bad bug in 6.6.0-6 with DICOM
Posted: 2010-04-01T13:03:57-07:00
by L F
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");
......