GDCM 2.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes
gdcm::StreamImageReader Class Reference

StreamImageReader. More...

`#include <gdcmStreamImageReader.h>`

Collaboration diagram for gdcm::StreamImageReader:
[legend]

List of all members.

## Public Member Functions

| StreamImageReader ()
| ~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 (void *inReadBuffer, const std::size_t &inBufferLength)
virtual bool | ReadImageInformation ()
void | SetFileName (const char *inFileName)
void | SetStream (std::istream &inStream)

## Protected Member Functions

bool | ReadImageSubregionJpegLS (char *inReadBuffer, const std::size_t &inBufferLength)
virtual bool | ReadImageSubregionRAW (char *inReadBuffer, const std::size_t &inBufferLength)

## Protected Attributes

std::streamoff | mFileOffset
std::streamoff | mFileOffset1
DataSet | mHeaderInformation
Reader | mReader
uint16_t | mXMax
uint16_t | mXMin
uint16_t | mYMax
uint16_t | mYMin
uint16_t | mZMax
uint16_t | mZMin

## Detailed Description

StreamImageReader.

Note:
  its role is to convert the DICOM DataSet into a gdcm::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 threadsafe 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:
  StreamImageReaderTest.cxx.

## Constructor & Destructor Documentation

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

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

## Member Function Documentation

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.

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. 15 nov 2010: added z dimension, defaults to being 1 plane large

Examples:
  StreamImageReaderTest.cxx.

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:
  StreamImageReaderTest.cxx.

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

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:
  StreamImageReaderTest.cxx.

bool gdcm::StreamImageReader::Read | ( | void * | 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 void* to std::ostream (internally) fails
3. the given buffer isn't large enough to accomodate 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:
  StreamImageReaderTest.cxx.

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 0x7fe0, 0x0010 tag.

Examples:
  StreamImageReaderTest.cxx.

bool gdcm::StreamImageReader::ReadImageSubregionJpegLS | ( | char * | inReadBuffer,
|  | const std::size_t & | inBufferLength
| ) |  | `[protected]`

Reads the file via JpegLS. The JpegLS codec, as of this writing, requires that the entire file be read in in order to decode a subregion, so that's what's done here.

virtual bool gdcm::StreamImageReader::ReadImageSubregionRAW | ( | char * | inReadBuffer,
|  | const std::size_t & | inBufferLength
| ) |  | `[protected, virtual]`

Using the min, max, etc set by DefinePixelExtent, this will fill the given buffer Make sure to call DefinePixelExtent and to initialize the buffer with the amount given by DefineProperBufferLength prior to calling this. reads by the RAW codec; other codecs are added once implemented

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:
  StreamImageReaderTest.cxx.

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

## Member Data Documentation

std::streamoff gdcm::StreamImageReader::mFileOffset`[protected]`

std::streamoff gdcm::StreamImageReader::mFileOffset1`[protected]`

DataSet gdcm::StreamImageReader::mHeaderInformation`[protected]`

Reader gdcm::StreamImageReader::mReader`[protected]`

uint16_t gdcm::StreamImageReader::mXMax`[protected]`

uint16_t gdcm::StreamImageReader::mXMin`[protected]`

uint16_t gdcm::StreamImageReader::mYMax`[protected]`

uint16_t gdcm::StreamImageReader::mYMin`[protected]`

uint16_t gdcm::StreamImageReader::mZMax`[protected]`

uint16_t gdcm::StreamImageReader::mZMin`[protected]`

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

- gdcmStreamImageReader.h