Transforms classes

Transform

class Transform

Represents a transform: a transform takes one Image as input, processes it and outputs the processed Image.

Subclassed by imebra::ModalityVOILUT, imebra::TransformHighBit, imebra::TransformsChain, imebra::VOILUT

Public Functions

bool isEmpty() const

Returns true if the transform doesn’t perform any processing (the output image will be identical to the input one).

Return
true if the Transform doesn’t perform any processing

Image *allocateOutputImage(const Image &inputImage, std::uint32_t width, std::uint32_t height) const

Allocate an image ready to accomodate the result of the image processing performed by the runTransform() method.

Return
an image ready to be passed as outputImage to runTransform()
Parameters
  • inputImage: the image that will be set as the input of the runTransform() method
  • width: the width of the output image
  • height: the height of the output image

void runTransform(const Image &inputImage, std::uint32_t inputTopLeftX, std::uint32_t inputTopLeftY, std::uint32_t inputWidth, std::uint32_t inputHeight, Image &outputImage, std::uint32_t outputTopLeftX, std::uint32_t outputTopLeftY) const

Run the processing function of the Transform.

Parameters
  • inputImage: the image to use as input

TransformHighBit

class TransformHighBit : public imebra::Transform

The TransformHighBit transform shifts the input image’s values so they match the high-bit settings of the Transform output image.

Public Functions

TransformHighBit()

Constructor.

TransformsChain

class TransformsChain : public imebra::Transform

The TransformsChain applies a series of Transforms to the input image.

Transforms can be added to the chain by using addTransform().

Public Functions

TransformsChain()

Constructor.

void addTransform(const Transform &transform)

Add a transform to the chain of transforms that will be applied to the input image.

Parameters
  • transform: the Transform to add to the chain of transforms

VOILUT

class VOILUT : public imebra::Transform

A VOILUT transform enhances the visibility of a specific range of brightness in an image.

The client can use VOILUT in three ways:

  • by declaring the minimum and maximum values of the pixels that must be visible via the method setCenterWidth()
  • by declaring a LUT via the method setLUT()
  • by letting the transform calculate the most appropriate center/width values via the method applyOptimalVOI()

The DataSet may already supply suitable values for the methods setCenterWidth() and setLUT().

In order to retrieve from the DataSet the suggested center/width values, call DataSet.getVOIs().

To get from the DataSet a list of LUTs that can be used with the VOILUT transform use DataSet.getLUT(TagId(tagId_t::VOILUTSequence_0028_3010), X) where X is a 0 base index (the DataSet may provide more than one LUT for the VOILUT transform).

Public Functions

VOILUT()

Constructor.

void applyOptimalVOI(const Image &inputImage, std::uint32_t topLeftX, std::uint32_t topLeftY, std::uint32_t width, std::uint32_t height)

Find the optimal VOI settings for a specific image’s area and apply it with setCenterWidth().

Parameters
  • inputImage: the image to analyze
  • topLeftX: the horizontal coordinate of the top-left angle of the area to analyze
  • topLeftY: the vertical coordinate of the top-left angle of the area to analyze
  • width: the width of the area to analyze
  • height: the height of the area to analyze

void setCenterWidth(double center, double width)

Set the VOI settings applied by the transform.

Parameters
  • center: the VOI center
  • width: the VOI width

void setLUT(const LUT &lut)

Set the LUT that will be used by the transform to enhance the contrast.

The LUTs to be used for the VOILUT transform are stored in the DataSet’s sequence tagId_t::VOILUTSequence_0028_3010 (group 0x0028, tag 0x3010). Each item in the sequence stores a single LUT.

Use DataSet::getLUT() to retrieve the LUT from the DataSet.

Parameters
  • lut: the LUT to apply

double getCenter() const

Retrieve the VOI center applied by the transform.

Return
the VOI center applied by the transform

double getWidth() const

Retrieve the VOI width applied by the transform.

Return
the VOI width applied by the transform

ModalityVOILUT

class ModalityVOILUT : public imebra::Transform

The ModalityVOILUT transform applies the Modality VOI or LUT to the input image.

The Modality VOI/LUT applies a rescale intercept and a slope to transform the pixel values of the image into values that are meaningful to the application.

For instance, the original pixel values could store a device specific value that has a meaning only when used by the device that generated it: applying the rescale slope/intercept to pixel value converts the original values into optical density or other known measurement units (e.g. Hounsfield).

When the transformation is not linear, then a LUT (lookup table) is applied.

Public Functions

ModalityVOILUT(const DataSet &dataset)

Constructor.

Parameters
  • dataset: the DataSet from which the modality VOI or LUT data is retrieved

ColorTransformsFactory

class ColorTransformsFactory

ColorTransformsFactory has the knowledge about the color spaces supported by the library: it can construct Transform objects that transform images’ content from one color space to another and can return specific information about the supported color spaces.

Public Static Functions

static std::string normalizeColorSpace(const std::string &colorSpace)

Normalize the name of a color space.

DICOM color spaces may contain additional information like the subsampling factor.

This method removes the additional information contained in the color space name and makes it upper-case, so it can be compared with other normalized color space names.

Return
the normalized color space name
Parameters
  • colorSpace: the color space name to normalize

static bool isMonochrome(const std::string &colorSpace)

Returns true if the specified color space name represents a monochromatic color space.

The method takes care of normalizing the color space before analyzing it.

Return
true if the normalized color space name represents a monochromatic color space
Parameters
  • colorSpace: the color space to test

static bool isSubsampledX(const std::string &colorSpace)

Returns true if the specified color space name contains additional information that specifies that the pixels are subsampled horizontally.

Return
true if the color space name specifies that each pixel is subsampled horizontally
Parameters
  • colorSpace: the color space to test for additional information about horizontal subsampling

static bool isSubsampledY(const std::string &colorSpace)

Returns true if the specified color space name contains additional information that specifies that the pixels are subsampled vertically.

Return
true if the color space name specifies that each pixel is subsampled vertically
Parameters
  • colorSpace: the color space to test for additional information about vertical subsampling

static bool canSubsample(const std::string &colorSpace)

Returns true if the specified color space name supports subsampling information.

Return
true if subsampling information can be added to the specified color space name
Parameters
  • colorSpace: the color space to test

static std::string makeSubsampled(const std::string &colorSpace, bool bSubsampleX, bool bSubsampleY)

Add subsampling information to the specified color space name.

Return
the specified color space name with additional information about the pixels subsampling
Parameters
  • colorSpace: the color space to which the subsampling information must be added
  • bSubsampleX: true if the pixels are subsampled horizontally
  • bSubsampleY: true if the pixels are subsampled vertically

static std::uint32_t getNumberOfChannels(const std::string &colorSpace)

Returns the number of color channels necessary for the specified color space.

Return
the number of color channels necessary to the specified color space
Parameters
  • colorSpace: the color space name

static Transform *getTransform(const std::string &startColorSpace, const std::string &endColorSpace)

Returns a Transform object able to transform an image’s content from one color space to another one.

Return
a Transform object able to transform the image’s content from input color space to output one
Parameters
  • startColorSpace: the color space of the input image’s content
  • endColorSpace: the color space of the output image’s content