Imaging classes

ImebraImage

class ImebraImage : public NSObject

Represents a DICOM image.

The class manages an uncompressed DICOM image. Images are compressed when they are inserted into the DataSet via DataSet::setImage() and are decompressed when they are referenced by the Image class.

The image is stored in a contiguous area of memory: each channel’s value can occupy 1, 2 or 4 bytes, according to the Image’s data type.

Channels’ values are always interleaved in the Image class, regardless of how they are stored in the DataSet object.

Public Functions

id ImebraImage::initWithWidth:height:depth:colorSpace:highBit:(unsigned int width, unsigned int height, ImebraBitDepth_t depth, NSString * colorSpace, unsigned int highBit)

Initializer.

The memory for the image is not allocated by the constructor but only when a WritingDataHandler is requested with getWritingDataHandler().

Parameters
  • width: the image width, in pixels
  • height: the image height, in pixels
  • depth: the channel values data types
  • colorSpace: the Image’s color space
  • highBit: the highest bit occupied by the channels’ values

ImebraReadingDataHandlerNumeric* ImebraImage::getReadingDataHandler:(NSError ** pError)

Retrieve a ImebraReadingDataHandlerNumeric object referencing the image’s memory (read only).

The memory referenced by ImageReadingDataHandlerNumeric contains all the image’s pixels. The color channels are interleaved.

Return
a ImebraReadingDataHandlerNumeric object referencing the Image’s memory in read-only mode

ImebraWritingDataHandlerNumeric* ImebraImage::getWritingDataHandler:(NSError ** pError)

Retrieve a ImebraWritingDataHandlerNumeric object referencing the image’s memory (mutable).

The memory referenced by the ImebraWritingDataHandlerNumeric object is uninitialized.

When the ImebraWritingDataHandlerNumeric object is destroyed then the memory managed by the handler replaces the old image’s memory.

Return
a ImebraWritingDataHandlerNumeric object referencing an uninitialized memory buffer that the client has to fill the the image’s data

Property

property ImebraImage::widthMm

Image’s width, in millimiters.

property ImebraImage::heightMm

Image’s height, in millimiters.

property ImebraImage::width

Retrieve the image’s width, in pixels.

property ImebraImage::height

Retrieve the image’s height, in pixels.

property ImebraImage::colorSpace

Retrieve the Image’s color space.

property ImebraImage::getChannelsNumber

Return the number of color channels contained by the image.

property ImebraImage::getDepth

Return the type of the channels’ values.

property ImebraImage::getHighBit

Return the highest bit occupied by the channels’ values.

ImebraDrawBitmap

class ImebraDrawBitmap : public NSObject

ImebraDrawBitmap takes care of converting an Image object into an array of bytes that can be displayed by the operating system facilities.

ImebraDrawBitmap can apply several transformations to the Image before generating the bitmap.

DrawBitmap applies automatically the necessary color transform and high bit shift in order to obtain a 8 bits per channel RGB image.

Public Functions

id init()

Initializes a ImebraDrawBitmap with no transforms.

The getBitmap() method will not apply any transform to the Image before generating the bitmap (except for the high bit and color space to obtain a 24bpp RGB image).

id ImebraDrawBitmap::initWithTransform:(ImebraTransform * pTransform)

Initializes a ImebraDrawBitmap object that always apply the transform specified in the parameter when calling getBitmap() or getImebraImage().

Parameters
  • pTransform: the transforms to apply to the Image in the getBitmap() method

ImebraReadWriteMemory* ImebraDrawBitmap::getBitmap:bitmapType:rowAlignBytes:error:(ImebraImage * pImage, ImebraDrawBitmapType_t drawBitmapType, unsigned int rowAlignBytes, NSError ** pError)

Apply the transforms defined in the constructor (if any) to the input image, then calculate an array of bytes containing a bitmap that can be rendered by the operating system.

Return
a ImebraReadWriteMemory object referencing the buffer containing the generated bitmap
Parameters
  • pImage: the image for which the bitmap must be calculated
  • drawBitmapType: the type of bitmap to generate
  • rowAlignBytes: the number of bytes on which the bitmap rows are aligned
  • pError: set to a NSError derived class in case of error

NSImage* ImebraDrawBitmap::getImebraImage:error:(ImebraImage * pImage, NSError ** pError)

Apply the transforms defined in the constructor (if any) to the input image, then return a NSImage (on OS-X) or an UIImage (on iOS).

Return
a NSImage on OS-X or an UIImage on iOS
Parameters
  • pImage: the image for which the NSImage or UIImage must be calculated
  • pError: set to a NSError derived class in case of error