% July 1992 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2012 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 %
/*
Include declarations.
*/
-#include "magick/studio.h"
-#include "magick/property.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/color.h"
-#include "magick/color-private.h"
-#include "magick/colormap.h"
-#include "magick/colormap-private.h"
-#include "magick/constitute.h"
-#include "magick/enhance.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/option.h"
-#include "magick/resource_.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/string-private.h"
-#include "magick/module.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/property.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/color.h"
+#include "MagickCore/color-private.h"
+#include "MagickCore/colormap.h"
+#include "MagickCore/colormap-private.h"
+#include "MagickCore/constitute.h"
+#include "MagickCore/enhance.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/option.h"
+#include "MagickCore/pixel-accessor.h"
+#include "MagickCore/resource_.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/string-private.h"
+#include "MagickCore/module.h"
\f
/*
Dicom medical image declarations.
Quantum
*scale;
- register IndexPacket
- *indexes;
-
register ssize_t
i,
x;
- register PixelPacket
+ register Quantum
*q;
register unsigned char
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
count=ReadBlob(image,(size_t) quantum*length,data);
if (count != (ssize_t) (quantum*length))
{
- (void) FormatLocaleFile(stdout,"count=%d quantum=%d length=%d "
- "group=%d\n",(int) count,(int) quantum,(int) length,(int)
- group);
+ (void) FormatLocaleFile(stdout,"count=%d quantum=%d "
+ "length=%d group=%d\n",(int) count,(int) quantum,(int)
+ length,(int) group);
ThrowReaderException(CorruptImageError,
"InsufficientImageDataInFile");
}
(void) CopyMagickString(transfer_syntax,(char *) data,
MaxTextExtent);
if (image_info->verbose != MagickFalse)
- (void) FormatLocaleFile(stdout,"transfer_syntax=%s\n",(const char*)
- transfer_syntax);
+ (void) FormatLocaleFile(stdout,"transfer_syntax=%s\n",
+ (const char*) transfer_syntax);
if (strncmp(transfer_syntax,"1.2.840.10008.1.2",17) == 0)
{
int
if ((i == (ssize_t) length) || (length > 4))
{
(void) SubstituteString(&attribute," ","");
- (void) SetImageProperty(image,attribute,(char *) data);
+ (void) SetImageProperty(image,attribute,(char *) data,exception);
}
attribute=DestroyString(attribute);
}
while (property != (const char *) NULL)
{
(void) SetImageProperty(jpeg_image,property,
- GetImageProperty(image,property));
+ GetImageProperty(image,property,exception),exception);
property=GetNextImageProperty(image);
}
AppendImageToList(&images,jpeg_image);
image->columns=(size_t) width;
image->rows=(size_t) height;
image->depth=depth;
- if ((image->colormap == (PixelPacket *) NULL) && (samples_per_pixel == 1))
+ if ((image->colormap == (PixelInfo *) NULL) && (samples_per_pixel == 1))
{
size_t
one;
one=1;
if (colors == 0)
colors=one << depth;
- if (AcquireImageColormap(image,colors) == MagickFalse)
+ if (AcquireImageColormap(image,one << depth,exception) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (redmap != (int *) NULL)
for (i=0; i < (ssize_t) colors; i++)
for (y=0; y < (ssize_t) image->rows; y++)
{
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
{
case 0:
{
- SetRedPixelComponent(q,ScaleCharToQuantum((unsigned char)
- ReadDCMByte(stream_info,image)));
+ SetPixelRed(image,ScaleCharToQuantum((unsigned char)
+ ReadDCMByte(stream_info,image)),q);
break;
}
case 1:
{
- SetGreenPixelComponent(q,ScaleCharToQuantum((unsigned char)
- ReadDCMByte(stream_info,image)));
+ SetPixelGreen(image,ScaleCharToQuantum((unsigned char)
+ ReadDCMByte(stream_info,image)),q);
break;
}
case 2:
{
- SetBluePixelComponent(q,ScaleCharToQuantum((unsigned char)
- ReadDCMByte(stream_info,image)));
+ SetPixelBlue(image,ScaleCharToQuantum((unsigned char)
+ ReadDCMByte(stream_info,image)),q);
break;
}
case 3:
{
- SetOpacityPixelComponent(q,(QuantumRange-
- ScaleCharToQuantum((unsigned char) ReadDCMByte(stream_info,
- image))));
+ SetPixelAlpha(image,ScaleCharToQuantum((unsigned char)
+ ReadDCMByte(stream_info,image)),q);
break;
}
default:
break;
}
- q++;
+ q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
int
byte;
- LongPixelPacket
+ PixelPacket
pixel;
/*
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
if (samples_per_pixel == 1)
pixel_value=(int) (polarity != MagickFalse ? (max_value-
ReadDCMLSBShort(stream_info,image)) :
ReadDCMLSBShort(stream_info,image));
- if (signed_data == 1)
- pixel_value=((signed short) pixel_value);
}
else
{
0.5)/(window_width-1))+0.5));
}
index&=mask;
- index=(int) ConstrainColormapIndex(image,(size_t) index);
- SetIndexPixelComponent(indexes+x,index);
+ index=(int) ConstrainColormapIndex(image,(size_t) index,
+ exception);
+ SetPixelIndex(image,index,q);
pixel.red=1UL*image->colormap[index].red;
pixel.green=1UL*image->colormap[index].green;
pixel.blue=1UL*image->colormap[index].blue;
pixel.blue=scale[pixel.blue];
}
}
- SetRedPixelComponent(q,pixel.red);
- SetGreenPixelComponent(q,pixel.green);
- SetBluePixelComponent(q,pixel.blue);
- q++;
+ SetPixelRed(image,pixel.red,q);
+ SetPixelGreen(image,pixel.green,q);
+ SetPixelBlue(image,pixel.blue,q);
+ q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
- indexes=GetAuthenticIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
{
if (samples_per_pixel == 1)
0.5)/(window_width-1))+0.5));
}
index&=mask;
- index=(int) ConstrainColormapIndex(image,(size_t) index);
- SetIndexPixelComponent(indexes+x,(((size_t)
- GetIndexPixelComponent(indexes+x)) | (((size_t) index) <<
- 8)));
+ index=(int) ConstrainColormapIndex(image,(size_t) index,
+ exception);
+ SetPixelIndex(image,(((size_t) GetPixelIndex(image,q)) |
+ (((size_t) index) << 8)),q);
pixel.red=1UL*image->colormap[index].red;
pixel.green=1UL*image->colormap[index].green;
pixel.blue=1UL*image->colormap[index].blue;
pixel.blue=scale[pixel.blue];
}
}
- SetRedPixelComponent(q,(((size_t) GetRedPixelComponent(q)) |
- (((size_t) pixel.red) << 8)));
- SetGreenPixelComponent(q,(((size_t) GetGreenPixelComponent(q)) |
- (((size_t) pixel.green) << 8)));
- SetBluePixelComponent(q,(((size_t) GetBluePixelComponent(q)) |
- (((size_t) pixel.blue) << 8)));
- q++;
+ SetPixelRed(image,(((size_t) GetPixelRed(image,q)) |
+ (((size_t) pixel.red) << 8)),q);
+ SetPixelGreen(image,(((size_t) GetPixelGreen(image,q)) |
+ (((size_t) pixel.green) << 8)),q);
+ SetPixelBlue(image,(((size_t) GetPixelBlue(image,q)) |
+ (((size_t) pixel.blue) << 8)),q);
+ q+=GetPixelChannels(image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
/*
Allocate next image structure.
*/
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);