02671 {
02672
char
02673 explicit_vr[
MaxTextExtent],
02674 implicit_vr[
MaxTextExtent],
02675 magick[
MaxTextExtent],
02676 photometric[
MaxTextExtent],
02677 transfer_syntax[
MaxTextExtent];
02678
02679
Image
02680 *image;
02681
02682
long
02683 datum,
02684 element,
02685 group,
02686 scene,
02687 y;
02688
02689
MagickBooleanType
02690 explicit_file,
02691 use_explicit;
02692
02693
Quantum
02694 *scale;
02695
02696
register IndexPacket
02697 *indexes;
02698
02699
register long
02700 i,
02701 x;
02702
02703
register PixelPacket
02704 *q;
02705
02706
register unsigned char
02707 *p;
02708
02709
ssize_t
02710 count;
02711
02712 size_t
02713 length;
02714
02715
unsigned char
02716 *data;
02717
02718
unsigned long
02719 bits_allocated,
02720 bytes_per_pixel,
02721 height,
02722 index,
02723 mask,
02724 max_value,
02725 msb_first,
02726 number_scenes,
02727 quantum,
02728 samples_per_pixel,
02729 significant_bits,
02730 status,
02731 width;
02732
02733
unsigned short
02734 *graymap;
02735
02736
02737
02738
02739
assert(image_info != (
const ImageInfo *) NULL);
02740
assert(image_info->
signature == MagickSignature);
02741
if (image_info->
debug !=
MagickFalse)
02742 (
void)
LogMagickEvent(TraceEvent,
GetMagickModule(),image_info->
filename);
02743
assert(exception != (
ExceptionInfo *) NULL);
02744
assert(exception->
signature == MagickSignature);
02745 image=
AllocateImage(image_info);
02746 status=
OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
02747
if (status ==
MagickFalse)
02748 {
02749
DestroyImageList(image);
02750
return((
Image *) NULL);
02751 }
02752
02753
02754
02755 count=
ReadBlob(image,128,(
unsigned char *) magick);
02756 count=
ReadBlob(image,4,(
unsigned char *) magick);
02757
if ((count == 0) || (
LocaleNCompare(magick,
"DICM",4) != 0))
02758 (
void)
SeekBlob(image,0L,SEEK_SET);
02759
02760
02761
02762 (
void) strcpy(photometric,
"MONOCHROME1 ");
02763 bits_allocated=8;
02764 bytes_per_pixel=1;
02765 data=NULL;
02766 element=0;
02767 explicit_vr[2]=
'\0';
02768 explicit_file=
MagickFalse;
02769 graymap=(
unsigned short *) NULL;
02770 group=0;
02771 height=0;
02772 max_value=255UL;
02773 mask=0xffff;
02774 number_scenes=1;
02775 samples_per_pixel=1;
02776 significant_bits=0;
02777 *transfer_syntax=
'\0';
02778 use_explicit=
MagickFalse;
02779 width=0;
02780
while ((group != 0x7FE0) || (element != 0x0010))
02781 {
02782
02783
02784
02785 image->
offset=(
long)
TellBlob(image);
02786 group=(
long)
ReadBlobLSBShort(image);
02787 element=(
long)
ReadBlobLSBShort(image);
02788 quantum=0;
02789
02790
02791
02792
for (i=0;
dicom_info[i].
group < 0xffff; i++)
02793
if ((group == (
long)
dicom_info[i].
group) &&
02794 (element == (
long)
dicom_info[i].
element))
02795
break;
02796 (
void)
CopyMagickString(implicit_vr,dicom_info[i].vr,MaxTextExtent);
02797 count=
ReadBlob(image,2,(
unsigned char *) explicit_vr);
02798
02799
02800
02801
if ((explicit_file ==
MagickFalse) && (group != 0x0002))
02802 explicit_file=(
MagickBooleanType)
02803 ((isupper((
int) *explicit_vr) !=
MagickFalse) &&
02804 (isupper((
int) *(explicit_vr+1)) !=
MagickFalse));
02805 use_explicit=(
MagickBooleanType)
02806 ((group == 0x0002) || (explicit_file !=
MagickFalse));
02807
if ((use_explicit !=
MagickFalse) && (
strcmp(implicit_vr,
"xs") == 0))
02808 (
void)
CopyMagickString(implicit_vr,explicit_vr,MaxTextExtent);
02809
if ((use_explicit ==
MagickFalse) || (
strcmp(implicit_vr,
"!!") == 0))
02810 {
02811 (
void)
SeekBlob(image,(MagickOffsetType) -2,SEEK_CUR);
02812 quantum=4;
02813 }
02814
else
02815 {
02816
02817
02818
02819 quantum=2;
02820
if ((
strcmp(explicit_vr,
"OB") == 0) ||
02821 (
strcmp(explicit_vr,
"UN") == 0) ||
02822 (
strcmp(explicit_vr,
"OW") == 0) || (
strcmp(explicit_vr,
"SQ") == 0))
02823 {
02824 (
void)
ReadBlobLSBShort(image);
02825 quantum=4;
02826 }
02827 }
02828 datum=0;
02829
if (quantum == 4)
02830 datum=(
long)
ReadBlobLSBLong(image);
02831
else
02832
if (quantum == 2)
02833 datum=(
long)
ReadBlobLSBShort(image);
02834 quantum=0;
02835 length=1;
02836
if (datum != 0)
02837 {
02838
if ((
strcmp(implicit_vr,
"SS") == 0) ||
02839 (
strcmp(implicit_vr,
"US") == 0))
02840 quantum=2;
02841
else
02842
if ((
strcmp(implicit_vr,
"UL") == 0) ||
02843 (
strcmp(implicit_vr,
"SL") == 0) ||
02844 (
strcmp(implicit_vr,
"FL") == 0))
02845 quantum=4;
02846
else
02847
if (
strcmp(implicit_vr,
"FD") != 0)
02848 quantum=1;
02849
else
02850 quantum=8;
02851
if (datum != -1)
02852 length=(size_t) datum/quantum;
02853
else
02854 {
02855
02856
02857
02858 quantum=0;
02859 length=0;
02860 }
02861 }
02862
if (image_info->
verbose !=
MagickFalse)
02863 {
02864
02865
02866
02867
if (use_explicit ==
MagickFalse)
02868 explicit_vr[0]=
'\0';
02869
for (i=0;
dicom_info[i].
description != (
char *) NULL; i++)
02870
if ((group == (
long)
dicom_info[i].
group) &&
02871 (element == (
long)
dicom_info[i].
element))
02872
break;
02873 (
void) fprintf(stdout,
"0x%04lX %4ld %s-%s (0x%04lx,0x%04lx)",
02874 (
unsigned long) image->
offset,(
long) length,implicit_vr,
02875 explicit_vr,(
unsigned long) group,(
unsigned long) element);
02876
if (
dicom_info[i].
description != (
char *) NULL)
02877 (
void) fprintf(stdout,
" %s",dicom_info[i].description);
02878 (
void) fprintf(stdout,
": ");
02879 }
02880
if ((group == 0x7FE0) && (element == 0x0010))
02881 {
02882
if (image_info->
verbose !=
MagickFalse)
02883 (
void) fprintf(stdout,
"\n");
02884
break;
02885 }
02886
02887
02888
02889 data=(
unsigned char *) NULL;
02890
if ((length == 1) && (quantum == 1))
02891 datum=
ReadBlobByte(image);
02892
else
02893
if ((length == 1) && (quantum == 2))
02894 datum=(
long)
ReadBlobLSBShort(image);
02895
else
02896
if ((length == 1) && (quantum == 4))
02897 datum=(
long)
ReadBlobLSBLong(image);
02898
else
02899
if ((quantum != 0) && (length != 0))
02900 {
02901 data=(
unsigned char *)
02902
AcquireMagickMemory((size_t) quantum*(length+1));
02903
if (data == (
unsigned char *) NULL)
02904
ThrowReaderException(ResourceLimitError,
02905
"MemoryAllocationFailed");
02906 (
void)
ReadBlob(image,(size_t) quantum*length,data);
02907 data[length*quantum]=
'\0';
02908 }
02909
switch (group)
02910 {
02911
case 0x0002:
02912 {
02913
switch (element)
02914 {
02915
case 0x0010:
02916 {
02917
02918
02919
02920 (
void)
CopyMagickString(transfer_syntax,(
char *) data,
02921 MaxTextExtent);
02922
if (
strcmp(transfer_syntax,
"1.2.840.10008.1.2.5") == 0)
02923
ThrowReaderException(CoderError,
"RLECompressionNotSupported");
02924
break;
02925 }
02926
default:
02927
break;
02928 }
02929
break;
02930 }
02931
case 0x0008:
02932 {
02933
switch (element)
02934 {
02935
case 0x0020:
02936 {
02937 (
void)
SetImageAttribute(image,
"StudyDate",(
char *) data);
02938
break;
02939 }
02940
default:
02941
break;
02942 }
02943
break;
02944 }
02945
case 0x0010:
02946 {
02947
switch (element)
02948 {
02949
case 0x0010:
02950 {
02951 (
void)
SetImageAttribute(image,
"PatientName",(
char *) data);
02952
break;
02953 }
02954
default:
02955
break;
02956 }
02957
break;
02958 }
02959
case 0x0018:
02960 {
02961
switch (element)
02962 {
02963
case 0x1060:
02964 {
02965 (
void)
SetImageAttribute(image,
"TriggerTime",(
char *) data);
02966
break;
02967 }
02968
default:
02969
break;
02970 }
02971
break;
02972 }
02973
case 0x0019:
02974 {
02975
switch (element)
02976 {
02977
case 0x101e:
02978 {
02979 (
void)
SetImageAttribute(image,
"FieldOfView",(
char *) data);
02980
break;
02981 }
02982
default:
02983
break;
02984 }
02985
break;
02986 }
02987
case 0x0020:
02988 {
02989
switch (element)
02990 {
02991
case 0x0011:
02992 {
02993 (
void)
SetImageAttribute(image,
"SeriesNumber",(
char *) data);
02994
break;
02995 }
02996
case 0x0032:
02997 {
02998 (
void)
SetImageAttribute(image,
"ImagePosition",(
char *) data);
02999
break;
03000 }
03001
case 0x0037:
03002 {
03003 (
void)
SetImageAttribute(image,
"ImageOrientation",(
char *) data);
03004
break;
03005 }
03006
case 0x1041:
03007 {
03008 (
void)
SetImageAttribute(image,
"SliceLocation",(
char *) data);
03009
break;
03010 }
03011
default:
03012
break;
03013 }
03014
break;
03015 }
03016
case 0x0028:
03017 {
03018
switch (element)
03019 {
03020
case 0x0002:
03021 {
03022
03023
03024
03025 samples_per_pixel=(
unsigned long) datum;
03026
break;
03027 }
03028
case 0x0004:
03029 {
03030
03031
03032
03033
for (i=0; i < (
long) length; i++)
03034 photometric[i]=(
char) data[i];
03035 photometric[i]=
'\0';
03036
break;
03037 }
03038
case 0x0006:
03039 {
03040
03041
03042
03043
if (datum == 1)
03044 image->
interlace=
PlaneInterlace;
03045
break;
03046 }
03047
case 0x0008:
03048 {
03049
03050
03051
03052 number_scenes=(
unsigned long) atol((
char *) data);
03053
break;
03054 }
03055
case 0x0010:
03056 {
03057
03058
03059
03060 height=(
unsigned long) datum;
03061
break;
03062 }
03063
case 0x0011:
03064 {
03065
03066
03067
03068 width=(
unsigned long) datum;
03069
break;
03070 }
03071
case 0x0100:
03072 {
03073
03074
03075
03076 bits_allocated=(
unsigned long) datum;
03077 bytes_per_pixel=1;
03078
if (datum > 8)
03079 bytes_per_pixel=2;
03080 max_value=(1UL << bits_allocated)-1;
03081
break;
03082 }
03083
case 0x0101:
03084 {
03085
03086
03087
03088 significant_bits=(
unsigned long) datum;
03089 bytes_per_pixel=1;
03090
if (significant_bits > 8)
03091 bytes_per_pixel=2;
03092 max_value=(1UL << significant_bits)-1;
03093 mask=(1UL << significant_bits)-1;
03094
break;
03095 }
03096
case 0x0102:
03097 {
03098
03099
03100
03101
break;
03102 }
03103
case 0x0103:
03104 {
03105
03106
03107
03108
break;
03109 }
03110
case 0x1200:
03111
case 0x3006:
03112 {
03113
unsigned long
03114 colors;
03115
03116
03117
03118
03119
if (data == (
unsigned char *) NULL)
03120
break;
03121 colors=(
unsigned long) (length/bytes_per_pixel);
03122 datum=(
long) colors;
03123 graymap=(
unsigned short *)
03124
AcquireMagickMemory((size_t) colors*
sizeof(*graymap));
03125
if (graymap == (
unsigned short *) NULL)
03126
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
03127
for (i=0; i < (
long) colors; i++)
03128
if (bytes_per_pixel == 1)
03129 graymap[i]=(
unsigned short) data[i];
03130
else
03131 graymap[i]=(
unsigned short) ((
short *) data)[i];
03132
break;
03133 }
03134
case 0x1201:
03135
case 0x1202:
03136
case 0x1203:
03137 {
03138
03139
03140
03141
if (
AllocateImageColormap(image,(
unsigned long) length/2) ==
MagickFalse)
03142
ThrowReaderException(ResourceLimitError,
"UnableToCreateColormap");
03143 p=data;
03144
for (i=0; i < (
long) image->
colors; i++)
03145 {
03146 index=(
unsigned long) ((*p) | (*(p+1)) << 8);
03147
if (element == 0x1201)
03148 image->
colormap[i].
red=
ScaleShortToQuantum(index);
03149
if (element == 0x1202)
03150 image->
colormap[i].
green=
ScaleShortToQuantum(index);
03151
if (element == 0x1203)
03152 image->
colormap[i].
blue=
ScaleShortToQuantum(index);
03153 p+=2;
03154 }
03155
break;
03156 }
03157 }
03158
break;
03159 }
03160
default:
03161
break;
03162 }
03163
if (image_info->
verbose !=
MagickFalse)
03164 {
03165
if (data == (
unsigned char *) NULL)
03166 (
void) fprintf(stdout,
"%ld\n",datum);
03167
else
03168 {
03169
03170
03171
03172
for (i=0; i < (
long)
Max(length,4); i++)
03173
if (isprint((
int) data[i]) ==
MagickFalse)
03174
break;
03175
if ((i != (
long) length) && (length <= 4))
03176 {
03177
long
03178 j;
03179
03180 datum=0;
03181
for (j=(
long) length-1; j >= 0; j--)
03182 datum=(256*datum+(
long) data[j]);
03183 (
void) fprintf(stdout,
"%ld",datum);
03184 }
03185
else
03186
for (i=0; i < (
long) length; i++)
03187
if (isprint((
int) data[i]) !=
MagickFalse)
03188 (
void) fprintf(stdout,
"%c",data[i]);
03189
else
03190 (
void) fprintf(stdout,
"%c",
'.');
03191 (
void) fprintf(stdout,
"\n");
03192 }
03193 }
03194 data=(
unsigned char *)
RelinquishMagickMemory(data);
03195 }
03196
if ((width == 0) || (height == 0))
03197
ThrowReaderException(CorruptImageError,
"ImproperImageHeader");
03198
if ((
strcmp(transfer_syntax,
"1.2.840.10008.1.2.4.50") == 0) ||
03199 (
strcmp(transfer_syntax,
"1.2.840.10008.1.2.4.70") == 0))
03200 {
03201
char
03202 filename[
MaxTextExtent];
03203
03204 FILE
03205 *file;
03206
03207
int
03208 c,
03209 unique_file;
03210
03211
ImageInfo
03212 *read_info;
03213
03214
unsigned char
03215 magick[
MaxTextExtent];
03216
03217
03218
03219
03220 file=(FILE *) NULL;
03221 unique_file=
AcquireUniqueFileResource(filename);
03222
if (unique_file != -1)
03223 file=fdopen(unique_file,
"wb");
03224
if ((unique_file == -1) || (file == (FILE *) NULL))
03225 {
03226 (
void)
CopyMagickString(image->
filename,filename,MaxTextExtent);
03227
ThrowFileException(&image->
exception,FileOpenError,
03228
"UnableToCreateTemporaryFile",image->
filename);
03229
DestroyImageList(image);
03230
return((
Image *) NULL);
03231 }
03232 (
void)
ResetMagickMemory(magick,0,
sizeof(magick));
03233
while ((c=
ReadBlobByte(image)) != EOF)
03234 {
03235 magick[0]=magick[1];
03236 magick[1]=magick[2];
03237 magick[2]=(
unsigned char) c;
03238
if (memcmp(magick,
"\377\330\377",3) == 0)
03239
break;
03240 }
03241 (
void) fwrite(magick,1,3,file);
03242 c=
ReadBlobByte(image);
03243
while (c != EOF)
03244 {
03245 (
void) fputc(c,file);
03246 c=
ReadBlobByte(image);
03247 }
03248 (
void) fclose(file);
03249 image=
DestroyImage(image);
03250 read_info=
CloneImageInfo(image_info);
03251 read_info->
blob=(
void *) NULL;
03252 read_info->
length=0;
03253 (
void)
FormatMagickString(read_info->
filename,MaxTextExtent,
03254
"jpeg:%s",filename);
03255 image=
ReadImage(read_info,exception);
03256 (
void)
RelinquishUniqueFileResource(filename);
03257 read_info=
DestroyImageInfo(read_info);
03258
return(
GetFirstImageInList(image));
03259 }
03260 scale=(
Quantum *) NULL;
03261
if (max_value >
MaxRGB)
03262 {
03263
03264
03265
03266 scale=(
Quantum *)
03267
AcquireMagickMemory((size_t) (max_value+1)*
sizeof(*scale));
03268
if (scale == (
Quantum *) NULL)
03269
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
03270
for (i=0; i <= (
long) max_value; i++)
03271 scale[i]=
ScaleXToQuantum(i,max_value);
03272 }
03273 msb_first=(
MagickBooleanType)
03274 (
strcmp(transfer_syntax,
"1.2.840.10008.1.2.2") == 0);
03275
for (scene=0; scene < (
long) number_scenes; scene++)
03276 {
03277
03278
03279
03280 image->
columns=width;
03281 image->
rows=height;
03282
if ((image->
colormap == (
PixelPacket *) NULL) && (samples_per_pixel == 1))
03283
if (
AllocateImageColormap(image,MaxColormapSize) ==
MagickFalse)
03284
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
03285
if (image_info->
ping !=
MagickFalse)
03286
break;
03287
if ((samples_per_pixel > 1) && (image->
interlace ==
PlaneInterlace))
03288 {
03289
03290
03291
03292
for (i=0; i < (
long) samples_per_pixel; i++)
03293 {
03294
for (y=0; y < (
long) image->
rows; y++)
03295 {
03296 q=
GetImagePixels(image,0,y,image->
columns,1);
03297
if (q == (
PixelPacket *) NULL)
03298
break;
03299
for (x=0; x < (
long) image->
columns; x++)
03300 {
03301
switch ((
int) i)
03302 {
03303
case 0: q->
red=
ScaleCharToQuantum(
ReadBlobByte(image));
break;
03304
case 1: q->
green=
ScaleCharToQuantum(
ReadBlobByte(image));
break;
03305
case 2: q->
blue=
ScaleCharToQuantum(
ReadBlobByte(image));
break;
03306
case 3: q->
opacity=(
Quantum)
03307 (
MaxRGB-
ScaleCharToQuantum(
ReadBlobByte(image)));
break;
03308
default:
break;
03309 }
03310 q++;
03311 }
03312
if (
SyncImagePixels(image) ==
MagickFalse)
03313
break;
03314
if (image->
previous == (
Image *) NULL)
03315
if ((image->
progress_monitor != (
MagickProgressMonitor) NULL) &&
03316 (
QuantumTick(y,image->
rows) !=
MagickFalse))
03317 {
03318 status=image->
progress_monitor(LoadImageTag,y,image->
rows,
03319 image->
client_data);
03320
if (status ==
MagickFalse)
03321
break;
03322 }
03323 }
03324 }
03325 }
03326
else
03327 {
03328
LongPixelPacket
03329 pixel;
03330
03331
unsigned long
03332 byte;
03333
03334
03335
03336
03337 byte=0;
03338 i=0;
03339 (
void)
ResetMagickMemory(&pixel,0,
sizeof(pixel));
03340
for (y=0; y < (
long) image->
rows; y++)
03341 {
03342 q=
SetImagePixels(image,0,y,image->
columns,1);
03343
if (q == (
PixelPacket *) NULL)
03344
break;
03345 indexes=
GetIndexes(image);
03346
for (x=0; x < (
long) image->
columns; x++)
03347 {
03348
if (samples_per_pixel == 1)
03349 {
03350
if (bytes_per_pixel == 1)
03351 index=(
unsigned long)
ReadBlobByte(image);
03352
else
03353
if ((bits_allocated != 12) || (significant_bits != 12))
03354 {
03355
if (msb_first !=
MagickFalse)
03356 index=(
unsigned long)
ReadBlobMSBShort(image)-32767;
03357
else
03358 index=(
unsigned long)
ReadBlobLSBShort(image)-32767;
03359 }
03360
else
03361 {
03362
if ((i & 0x01) != 0)
03363 index=((
unsigned long)
ReadBlobByte(image) << 8) | byte;
03364
else
03365 {
03366
if (msb_first !=
MagickFalse)
03367 index=
ReadBlobMSBShort(image);
03368
else
03369 index=
ReadBlobLSBShort(image);
03370 byte=index & 0x0f;
03371 index>>=4;
03372 }
03373 i++;
03374 }
03375 index&=mask;
03376
if (graymap != (
unsigned short *) NULL)
03377 index=graymap[index];
03378
if (scale != (
Quantum *) NULL)
03379 index=scale[index];
03380 index=
ConstrainColormapIndex(image,index);
03381 indexes[x]=(
IndexPacket) index;
03382 pixel.
red=image->
colormap[index].
red;
03383 pixel.
green=image->
colormap[index].
green;
03384 pixel.
blue=image->
colormap[index].
blue;
03385 }
03386
else
03387 {
03388
if (bytes_per_pixel == 1)
03389 {
03390 pixel.
red=(
unsigned long)
ReadBlobByte(image);
03391 pixel.
green=(
unsigned long)
ReadBlobByte(image);
03392 pixel.
blue=(
unsigned long)
ReadBlobByte(image);
03393 }
03394
else
03395 {
03396
if (msb_first !=
MagickFalse)
03397 {
03398 pixel.
red=
ReadBlobMSBShort(image);
03399 pixel.
green=
ReadBlobMSBShort(image);
03400 pixel.
blue=
ReadBlobMSBShort(image);
03401 }
03402
else
03403 {
03404 pixel.
red=
ReadBlobLSBShort(image);
03405 pixel.
green=
ReadBlobLSBShort(image);
03406 pixel.
blue=
ReadBlobLSBShort(image);
03407 }
03408 }
03409 pixel.
red&=mask;
03410 pixel.
green&=mask;
03411 pixel.
blue&=mask;
03412
if (scale != (
Quantum *) NULL)
03413 {
03414 pixel.
red=scale[pixel.
red];
03415 pixel.
green=scale[pixel.
green];
03416 pixel.
blue=scale[pixel.
blue];
03417 }
03418 }
03419 q->
red=(
Quantum) pixel.
red;
03420 q->
green=(
Quantum) pixel.
green;
03421 q->
blue=(
Quantum) pixel.
blue;
03422 q++;
03423 }
03424
if (
SyncImagePixels(image) ==
MagickFalse)
03425
break;
03426
if (image->
previous == (
Image *) NULL)
03427
if ((image->
progress_monitor != (
MagickProgressMonitor) NULL) &&
03428 (
QuantumTick(y,image->
rows) !=
MagickFalse))
03429 {
03430 status=image->
progress_monitor(LoadImageTag,y,image->
rows,
03431 image->
client_data);
03432
if (status ==
MagickFalse)
03433
break;
03434 }
03435 }
03436
if (image->
storage_class ==
PseudoClass)
03437 (
void)
NormalizeImage(image);
03438 }
03439
if (
EOFBlob(image) !=
MagickFalse)
03440 {
03441
ThrowFileException(exception,CorruptImageError,
"UnexpectedEndOfFile",
03442 image->
filename);
03443
break;
03444 }
03445
03446
03447
03448
if (image_info->
number_scenes != 0)
03449
if (image->
scene >= (image_info->
scene+image_info->
number_scenes-1))
03450
break;
03451
if (scene < (
long) (number_scenes-1))
03452 {
03453
03454
03455
03456
AllocateNextImage(image_info,image);
03457
if (image->
next == (
Image *) NULL)
03458 {
03459
DestroyImageList(image);
03460
return((
Image *) NULL);
03461 }
03462 image=
SyncNextImageInList(image);
03463
if (image->
progress_monitor != (
MagickProgressMonitor) NULL)
03464 {
03465 status=image->
progress_monitor(LoadImagesTag,
TellBlob(image),
03466
GetBlobSize(image),image->
client_data);
03467
if (status ==
MagickFalse)
03468
break;
03469 }
03470 }
03471 }
03472
03473
03474
03475
if (scale != (
Quantum *) NULL)
03476 scale=(
Quantum *)
RelinquishMagickMemory(scale);
03477
return(
GetFirstImageInList(image));
03478 }