gdcm::StreamImageReader Class Reference

StreamImageReader. More...

`#include <gdcmStreamImageReader.h>`

## Public Member Functions

| StreamImageReader ()
virtual | ~StreamImageReader ()
bool | CanReadImage () const
void | DefinePixelExtent (uint16_t inXMin, uint16_t inXMax, uint16_t inYMin, uint16_t inYMax, uint16_t inZMin=0, uint16_t inZMax=1)
uint32_t | DefineProperBufferLength () const
std::vector< unsigned int > | GetDimensionsValueForResolution (unsigned int)
File const & | GetFile () const
bool | Read (char *inReadBuffer, const std::size_t &inBufferLength)
virtual bool | ReadImageInformation ()
void | SetFileName (const char *inFileName)
void | SetStream (std::istream &inStream)

## Detailed Description

StreamImageReader.

Note
  its role is to convert the DICOM DataSet into a Image representation via an ITK streaming (ie, multithreaded) interface Image is different from Pixmap has it has a position and a direction in Space. Currently, this class is thread safe in that it can read a single extent in a single thread. Multiple versions can be used for multiple extents/threads.

See also
  Image

Examples
  ExtractOneFrame.cs, and StreamImageReaderTest.cxx.

## Constructor & Destructor Documentation

## StreamImageReader()

gdcm::StreamImageReader::StreamImageReader | ( |  | ) |

## ~StreamImageReader()

virtual gdcm::StreamImageReader::~StreamImageReader | ( |  | ) |

virtual

## Member Function Documentation

## CanReadImage()

bool gdcm::StreamImageReader::CanReadImage | ( |  | ) | const

Only RAW images are currently readable by the stream reader. As more streaming codecs are added, then this function will be updated to reflect those changes. Calling this function prior to reading will ensure that only streamable files are streamed. Make sure to call ReadImageInformation prior to calling this function.

Examples
  StreamImageReaderTest.cxx.

## DefinePixelExtent()

void gdcm::StreamImageReader::DefinePixelExtent | ( | uint16_t | inXMin,
|  | uint16_t | inXMax,
|  | uint16_t | inYMin,
|  | uint16_t | inYMax,
|  | uint16_t | inZMin = 0,
|  | uint16_t | inZMax = 1 )

Defines an image extent for the Read function. DICOM states that an image can have no more than 2^16 pixels per edge (as of 2009) In this case, the pixel extents ignore the direction cosines entirely, and assumes that the origin of the image is at location 0,0 (regardless of the definition in space per the tags). So, if the first 100 pixels of the first row are to be read in, this function should be called with DefinePixelExtent(0, 100, 0, 1), regardless of pixel size or orientation.

Examples
  ExtractOneFrame.cs, and StreamImageReaderTest.cxx.

## DefineProperBufferLength()

uint32_t gdcm::StreamImageReader::DefineProperBufferLength | ( |  | ) | const

Paying attention to the pixel format and so forth, define the proper buffer length for the user. The return amount is in bytes. Call this function to determine the size of the char* buffer that will need to be passed in to ReadImageSubregion(). If the return is 0, then that means that the pixel extent was not defined prior

Examples
  ExtractOneFrame.cs, and StreamImageReaderTest.cxx.

## GetDimensionsValueForResolution()

std::vector< unsigned int > gdcm::StreamImageReader::GetDimensionsValueForResolution | ( | unsigned int |  | ) |

## GetFile()

File const & gdcm::StreamImageReader::GetFile | ( |  | ) | const

Returns the dataset read by ReadImageInformation Couple this with the ImageHelper to get statistics about the image, like pixel extent, to be able to initialize buffers for reading

Examples
  ExtractOneFrame.cs, and StreamImageReaderTest.cxx.

## Read()

bool gdcm::StreamImageReader::Read | ( | char * | inReadBuffer,
|  | const std::size_t & | inBufferLength )

Read the DICOM image. There are three reasons for failure:

1. The extent is not set
2. the conversion from char* to std::ostream (internally) fails
3. the given buffer isn't large enough to accommodate the desired pixel extent. This method has been implemented to look similar to the metaimageio in itk MUST have an extent defined, or else Read will return false. If no particular extent is required, use ImageReader instead.

Examples
  ExtractOneFrame.cs, and StreamImageReaderTest.cxx.

## ReadImageInformation()

virtual bool gdcm::StreamImageReader::ReadImageInformation | ( |  | ) |

virtual

Set the spacing and dimension information for the set filename. returns false if the file is not initialized or not an image, with the pixel (7fe0,0010) tag.

Examples
  ExtractOneFrame.cs, and StreamImageReaderTest.cxx.

## SetFileName()

void gdcm::StreamImageReader::SetFileName | ( | const char * | inFileName | ) |

One of either SetFileName or SetStream must be called prior to any other functions. These initialize an internal Reader class to be able to get non-pixel image information.

Examples
  ExtractOneFrame.cs, and StreamImageReaderTest.cxx.

## SetStream()

void gdcm::StreamImageReader::SetStream | ( | std::istream & | inStream | ) |

The documentation for this class was generated from the following file:

- gdcmStreamImageReader.h