% Read DICOM Image Format %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1992 %
% %
% %
-% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
MagickBooleanType
explicit_file,
- use_explicit,
explicit_retry,
- polarity;
+ polarity,
+ sequence,
+ use_explicit;
MagickOffsetType
offset;
window_center,
y;
-
unsigned char
*data;
number_scenes=1;
samples_per_pixel=1;
scale=(Quantum *) NULL;
+ sequence=MagickFalse;
signed_data=(~0UL);
significant_bits=0;
use_explicit=MagickFalse;
width=0;
window_center=0;
window_width=0;
- for (group=0; (group != 0x7FE0) || (element != 0x0010); )
+ for (group=0; (group != 0x7FE0) || (element != 0x0010) ||
+ (sequence != MagickFalse); )
{
/*
Read a group.
Check for "explicitness", but meta-file headers always explicit.
*/
if ((explicit_file == MagickFalse) && (group != 0x0002))
- explicit_file=(isupper((int) *explicit_vr) != MagickFalse) &&
- (isupper((int) *(explicit_vr+1)) != MagickFalse) ? MagickTrue :
- MagickFalse;
+ explicit_file=(isupper((unsigned char) *explicit_vr) != MagickFalse) &&
+ (isupper((unsigned char) *(explicit_vr+1)) != MagickFalse) ?
+ MagickTrue : MagickFalse;
use_explicit=((group == 0x0002) && (explicit_retry == MagickFalse)) ||
(explicit_file != MagickFalse) ? MagickTrue : MagickFalse;
if ((use_explicit != MagickFalse) && (strcmp(implicit_vr,"xs") == 0))
(void) FormatLocaleFile(stdout," %s",dicom_info[i].description);
(void) FormatLocaleFile(stdout,": ");
}
- if ((group == 0x7FE0) && (element == 0x0010))
+ if ((sequence == MagickFalse) && (group == 0x7FE0) && (element == 0x0010))
{
if (image_info->verbose != MagickFalse)
(void) FormatLocaleFile(stdout,"\n");
}
data[length*quantum]='\0';
}
+ else
+ if ((unsigned int) datum == 0xFFFFFFFFU)
+ {
+ sequence=MagickTrue;
+ continue;
+ }
+
+ if (((group << 16) | element) == 0xFFFEE0DD)
+ {
+ sequence=MagickFalse;
+ continue;
+ }
+
+ if (sequence != MagickFalse)
+ continue;
+
switch (group)
{
case 0x0002:
break;
}
default:
- {
- (void) FormatLocaleFile(stderr,"(%04x,%04x) %d %d "
- "not found in dictionary\n",(int) group,(int) element,(int)
- length,datum);
break;
- }
}
break;
}
break;
}
default:
- {
- (void) FormatLocaleFile(stderr,"(%04x,%04x) %d %d "
- "not found in dictionary\n",(int) group,(int) element,(int)
- length,datum);
break;
- }
}
break;
}
break;
}
default:
- {
- (void) FormatLocaleFile(stderr,"(%04x,%04x) %d %d "
- "not found in dictionary\n",(int) group,(int) element,(int)
- length,datum);
break;
- }
}
break;
}
default:
- {
- (void) FormatLocaleFile(stderr,"(%04x,%04x) %d %d "
- "not found in dictionary\n",(int) group,(int) element,(int) length,
- datum);
break;
- }
}
if (data != (unsigned char *) NULL)
{
"jpeg:%s",filename);
if (image->compression == JPEG2000Compression)
(void) FormatLocaleString(read_info->filename,MaxTextExtent,
- "jp2:%s",filename);
+ "j2k:%s",filename);
jpeg_image=ReadImage(read_info,exception);
if (jpeg_image != (Image *) NULL)
{
tag=(ReadBlobLSBShort(image) << 16) | ReadBlobLSBShort(image);
stream_info->remaining=(size_t) ReadBlobLSBLong(image);
if ((tag != 0xFFFEE000) || (stream_info->remaining <= 64) ||
- (EOFBlob(image) == MagickTrue))
+ (EOFBlob(image) != MagickFalse))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
stream_info->count=0;
stream_info->segment_count=ReadBlobLSBLong(image);