/*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % IIIIIIIIII PPPPPPPP LL %
- % II PP PP LL %
- % II PP PP LL %
- % II PP PP LL %
- % II PPPPPPPP LL %
- % II PP LL %
- % II PP LL %
- % IIIIIIIIII PP LLLLLLLL %
- % %
- % %
- % %
- % Read/Write Scanalytics IPLab Image Format %
- % Sean Burke %
- % 2008.05.07 %
- % v 0.9 %
- % %
- % Copyright 1999-2007 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 %
- % obtain a copy of the License at %
- % %
- % http://www.imagemagick.org/script/license.php %
- % %
- % Unless required by applicable law or agreed to in writing, software %
- % distributed under the License is distributed on an "AS IS" BASIS, %
- % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
- % See the License for the specific language governing permissions and %
- % limitations under the License. %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- %
- */
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% IIIIIIIIII PPPPPPPP LL %
+% II PP PP LL %
+% II PP PP LL %
+% II PP PP LL %
+% II PPPPPPPP LL %
+% II PP LL %
+% II PP LL %
+% IIIIIIIIII PP LLLLLLLL %
+% %
+% %
+% %
+% Read/Write Scanalytics IPLab Image Format %
+% Sean Burke %
+% 2008.05.07 %
+% v 0.9 %
+% %
+% 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 %
+% obtain a copy of the License at %
+% %
+% http://www.imagemagick.org/script/license.php %
+% %
+% Unless required by applicable law or agreed to in writing, software %
+% distributed under the License is distributed on an "AS IS" BASIS, %
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
+% See the License for the specific language governing permissions and %
+% limitations under the License. %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%
+*/
/*
Include declarations.
*/
-#include "magick/studio.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/colorspace.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/property.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/string_.h"
-#include "magick/module.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.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/property.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/module.h"
/*
Tyedef declarations
typedef struct _IPLInfo
{
- size_t
- tag,
- size,
- time,
- z,
- width,
- height,
- colors,
- depth,
- byteType;
+ unsigned int
+ tag,
+ size,
+ time,
+ z,
+ width,
+ height,
+ colors,
+ depth,
+ byteType;
} IPLInfo;
static MagickBooleanType
- WriteIPLImage(const ImageInfo *,Image *);
+ WriteIPLImage(const ImageInfo *,Image *,ExceptionInfo *);
void increase (void *pixel, int byteType){
switch(byteType){
image->columns = ipl->width;
image->rows = ipl->height;
image->depth = ipl->depth;
- image->x_resolution = 1;
- image->y_resolution = 1;
+ image->resolution.x = 1;
+ image->resolution.y = 1;
}
Image *image;
MagickBooleanType status;
- register PixelPacket *q;
+ register Quantum *q;
unsigned char magick[12], *pixels;
ssize_t count;
ssize_t y;
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)
{
If we get back "iiii", we have LSB,"mmmm", MSB
*/
count=ReadBlob(image,4,magick);
+ (void) count;
if((LocaleNCompare((char *) magick,"iiii",4) == 0))
image->endian=LSBEndian;
else{
if((ipl_info.width == 0UL) || (ipl_info.height == 0UL))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
ipl_info.colors=ReadBlobLong(image);
- if(ipl_info.colors == 3){ image->colorspace=RGBColorspace;}
+ if(ipl_info.colors == 3){ SetImageColorspace(image,sRGBColorspace,exception);}
else { image->colorspace = GRAYColorspace; }
ipl_info.z=ReadBlobLong(image);
ipl_info.time=ReadBlobLong(image);
if (image->scene >= (image_info->scene+image_info->number_scenes-1))
break;
/*
- printf("Length: %lu, Memory size: %lu\n", length,(size_t)(image->depth));
+ printf("Length: %.20g, Memory size: %.20g\n", (double) length,(double)
+ image->depth);
*/
quantum_info=AcquireQuantumInfo(image_info,image);
if (quantum_info == (QuantumInfo *) NULL)
pixels=GetQuantumPixels(quantum_info);
if(image->columns != ipl_info.width){
/*
- printf("Columns not set correctly! Wanted: %lu, got: %lu\n",
- ipl_info.width, image->columns);
+ printf("Columns not set correctly! Wanted: %.20g, got: %.20g\n",
+ (double) ipl_info.width, (double) image->columns);
*/
}
for(y = 0; y < (ssize_t) image->rows; y++){
(void) ReadBlob(image, length*image->depth/8, pixels);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
GrayQuantum,pixels,exception);
for(y = 0; y < (ssize_t) image->rows; y++){
(void) ReadBlob(image, length*image->depth/8, pixels);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
+ if (q == (Quantum *) NULL)
break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
RedQuantum,pixels,exception);
for(y = 0; y < (ssize_t) image->rows; y++){
(void) ReadBlob(image, length*image->depth/8, pixels);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
- break;
+ if (q == (Quantum *) NULL)
+ break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
GreenQuantum,pixels,exception);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
for(y = 0; y < (ssize_t) image->rows; y++){
(void) ReadBlob(image, length*image->depth/8, pixels);
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (PixelPacket *) NULL)
- break;
+ if (q == (Quantum *) NULL)
+ break;
(void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
BlueQuantum,pixels,exception);
if (SyncAuthenticPixels(image,exception) == MagickFalse)
/*
Proceed to next image.
*/
- AcquireNextImage(image_info, image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
}
/*
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % %
- % %
- % %
- % W r i t e I P L I m a g e %
- % %
- % %
- % %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % WriteIPLImage() writes an image to a file in Scanalytics IPLabimage format.
- %
- % The format of the WriteIPLImage method is:
- %
- % MagickBooleanType WriteIPLImage(const ImageInfo *image_info,Image *image)
- %
- % A description of each parameter follows.
- %
- % o image_info: The image info.
- %
- % o image: The image.
- %
- */
-
-static MagickBooleanType WriteIPLImage(const ImageInfo *image_info,Image *image)
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
+% W r i t e I P L I m a g e %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% WriteIPLImage() writes an image to a file in Scanalytics IPLabimage format.
+%
+% The format of the WriteIPLImage method is:
+%
+% MagickBooleanType WriteIPLImage(const ImageInfo *image_info,Image *image)
+% Image *image,ExceptionInfo *exception)
+%
+% A description of each parameter follows.
+%
+% o image_info: The image info.
+%
+% o image: The image.
+%
+% o exception: return any errors or warnings in this structure.
+%
+*/
+static MagickBooleanType WriteIPLImage(const ImageInfo *image_info,Image *image,
+ ExceptionInfo *exception)
{
- ExceptionInfo
- *exception;
+ IPLInfo
+ ipl_info;
MagickBooleanType
status;
MagickOffsetType
scene;
- register const PixelPacket
+ register const Quantum
*p;
- unsigned char
- *pixels;
-
- ssize_t
- y;
-
- IPLInfo
- ipl_info;
-
QuantumInfo
*quantum_info;
+ ssize_t
+ y;
+
+ unsigned char
+ *pixels;
+
/*
Open output image file.
*/
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
scene=0;
quantum_info=AcquireQuantumInfo(image_info, image);
if ((quantum_info->format == UndefinedQuantumFormat) &&
- (IsHighDynamicRangeImage(image,&image->exception) != MagickFalse))
+ (IsHighDynamicRangeImage(image,exception) != MagickFalse))
SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat);
switch(quantum_info->depth){
case 8:
break;
}
- ipl_info.z = GetImageListLength(image);
+ ipl_info.z = (unsigned int) GetImageListLength(image);
/* There is no current method for detecting whether we have T or Z stacks */
ipl_info.time = 1;
- ipl_info.width = image->columns;
- ipl_info.height = image->rows;
+ ipl_info.width = (unsigned int) image->columns;
+ ipl_info.height = (unsigned int) image->rows;
- if (image->colorspace != RGBColorspace)
- (void) TransformImageColorspace(image,RGBColorspace);
+ if (IssRGBColorspace(image->colorspace) == MagickFalse)
+ (void) TransformImageColorspace(image,sRGBColorspace,exception);
- if(image->colorspace == RGBColorspace) { ipl_info.colors = 3; }
+ if(IssRGBColorspace(image->colorspace) == MagickTrue) { ipl_info.colors = 3; }
else{ ipl_info.colors = 1; }
- ipl_info.size = 28 +
- ((image->depth)/8)*ipl_info.height*ipl_info.width*ipl_info.colors*ipl_info.z;
+ ipl_info.size = (unsigned int) (28 +
+ ((image->depth)/8)*ipl_info.height*ipl_info.width*ipl_info.colors*ipl_info.z);
/* Ok! Calculations are done. Lets write this puppy down! */
(void) WriteBlobLong(image, ipl_info.time);
(void) WriteBlobLong(image, ipl_info.byteType);
- exception=(&image->exception);
do
{
/*
if(ipl_info.colors == 1){
/* Red frame */
for(y = 0; y < (ssize_t) ipl_info.height; y++){
- p=GetAuthenticPixels(image,0,y,image->columns,1,exception);
- if (p == (PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- (void) ExportQuantumPixels(image,(const CacheView *) NULL, quantum_info,
- GrayQuantum, pixels,&image->exception);
+ (void) ExportQuantumPixels(image,(CacheView *) NULL, quantum_info,
+ GrayQuantum, pixels,exception);
(void) WriteBlob(image, image->columns*image->depth/8, pixels);
}
if(ipl_info.colors == 3){
/* Red frame */
for(y = 0; y < (ssize_t) ipl_info.height; y++){
- p=GetAuthenticPixels(image,0,y,image->columns,1,exception);
- if (p == (PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- (void) ExportQuantumPixels(image,(const CacheView *) NULL, quantum_info,
- RedQuantum, pixels,&image->exception);
+ (void) ExportQuantumPixels(image,(CacheView *) NULL, quantum_info,
+ RedQuantum, pixels,exception);
(void) WriteBlob(image, image->columns*image->depth/8, pixels);
}
/* Green frame */
for(y = 0; y < (ssize_t) ipl_info.height; y++){
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- (void) ExportQuantumPixels(image,(const CacheView *) NULL, quantum_info,
- GreenQuantum, pixels,&image->exception);
+ (void) ExportQuantumPixels(image,(CacheView *) NULL, quantum_info,
+ GreenQuantum, pixels,exception);
(void) WriteBlob(image, image->columns*image->depth/8, pixels);
}
/* Blue frame */
for(y = 0; y < (ssize_t) ipl_info.height; y++){
- p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
- if (p == (PixelPacket *) NULL)
+ p=GetVirtualPixels(image,0,y,image->columns,1,exception);
+ if (p == (const Quantum *) NULL)
break;
- (void) ExportQuantumPixels(image,(const CacheView *) NULL, quantum_info,
- BlueQuantum, pixels,&image->exception);
+ (void) ExportQuantumPixels(image,(CacheView *) NULL, quantum_info,
+ BlueQuantum, pixels,exception);
(void) WriteBlob(image, image->columns*image->depth/8, pixels);
if (image->previous == (Image *) NULL)
{
CloseBlob(image);
return(MagickTrue);
}
-
-