Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoVRDicomData Class Reference

VolumeViz DICOM data. More...

#include <VolumeViz/readers/SoVRDicomData.h>

Public Member Functions

 SoVRDicomData ()
 Constructor.
 
 ~SoVRDicomData ()
 Destructor.
 
SoNONUNICODE SbBool readDicomHeader (const char *fileName)
 Reads the DICOM file header.
 
SbBool readDicomHeader (const SbString &fileName)
 Reads the DICOM file header.
 
SoNONUNICODE SbBool readDicomImage (const char *fileName)
 Reads the DICOM image.
 
SbBool readDicomImage (const SbString &fileName)
 Reads the DICOM image.
 
SbBool close ()
 Closes the underlying reader.
 
int getNumFrames () const
 Returns the number of frames.
 
int getImageWidth () const
 Returns the image width.
 
int getImageHeight () const
 Returns the image height.
 
int getSizeInBytes () const
 Returns the image size in bytes.
 
int getBytesPerPixel () const
 Returns the number of bytes per pixel.
 
int getSamplesPerPixel () const
 Returns the number of samples per pixel.
 
SbBool supportedTransferSyntax () const
 Returns true if the transfer syntax is supported by Open Inventor.
 
void readFrame (size_t frame, const SbBox2i32 &subImg, uint8_t *dst) const
 Read a region of a DICOM frame.
 
const SiDicomDataSetgetDicomDataSet () const
 Returns a DICOM data object that allows accessing all the DICOM attributes.
 
float getSliceThicknessMM () const
 Returns the slice thickness in mm.
 
float getSliceSpacing () const
 Returns the slice spacing.
 
int getSeriesNumber () const
 Returns the series number.
 
int getImageNumber () const
 Returns the image number.
 
float getSliceLocation () const
 Returns the image location in mm.
 
float getXPixelSize () const
 Returns the X pixel size in mm.
 
float getYPixelSize () const
 Returns the Y pixel size in mm.
 
SbBool getPosition (SbVec3f &position) const
 Returns the 3D position of the center of the image.
 
SbVec3f getImagePosition () const
 Returns the position of the first frame's top left voxel center in the patient space.
 
SbBool getOrientation (SbMatrix &orientation) const
 Returns the orientation of the DICOM volume.
 
int getBitsStored () const
 Returns the number of bits stored.
 
int getHighBit () const
 Returns the high bit.
 
int signedData () const
 Returns the signed flag.
 
float getIntercept () const
 Returns the intercept.
 
float getSlope () const
 Returns the slope.
 
SbString getDicomInfo (unsigned short group, unsigned short element) const
 Generic method to get DICOM info.
 

Friends

class SoVRDicomFileReader
 

Detailed Description

VolumeViz DICOM data.

Access data in a DICOM data set.

DICOM is a widely used format for storing medical image data (CT, MRI, etc), defined by the National Electrical Manufacturers Association (NEMA) (http://medical.nema.org).

This class can be used to directly open and query information from DICOM format files. It can also be used to get DICOM specific information from a file opened by VolumeViz (see SoVRDicomFileReader).

Note that it only returns information for a single file, not (in general) for the complete volume.

To conveniently iterate over or randomly access all the DICOM attributes, see the getDicomDataSet() method.

SEE ALSO

SoVRDicomFileReader, SiDicomDataSet

Definition at line 62 of file SoVRDicomData.h.

Constructor & Destructor Documentation

◆ SoVRDicomData()

SoVRDicomData::SoVRDicomData ( )

Constructor.

◆ ~SoVRDicomData()

SoVRDicomData::~SoVRDicomData ( )

Destructor.

Member Function Documentation

◆ close()

SbBool SoVRDicomData::close ( )

Closes the underlying reader.

◆ getBitsStored()

int SoVRDicomData::getBitsStored ( ) const

Returns the number of bits stored.

◆ getBytesPerPixel()

int SoVRDicomData::getBytesPerPixel ( ) const

Returns the number of bytes per pixel.

◆ getDicomDataSet()

const SiDicomDataSet * SoVRDicomData::getDicomDataSet ( ) const

Returns a DICOM data object that allows accessing all the DICOM attributes.

Returns
a pointer to the created data set, that must be deleted by the application. If an error occurs, returns NULL.

◆ getDicomInfo()

SbString SoVRDicomData::getDicomInfo ( unsigned short  group,
unsigned short  element 
) const

Generic method to get DICOM info.

The group and element parameters should be given using the hexadecimal tag values defined by the DICOM specification. For example Rescale Slope is (0028,1053) and Rescale Intercept is (0028,1052).

To conveniently access the DICOM attributes, see the getDicomDataSet() method.

Parameters
grouphexadecimal group tag value to retrieve info from.
elementhexadecimal element tag value to retrieve info from in the group.
Returns
value info.

◆ getHighBit()

int SoVRDicomData::getHighBit ( ) const

Returns the high bit.

◆ getImageHeight()

int SoVRDicomData::getImageHeight ( ) const

Returns the image height.

◆ getImageNumber()

int SoVRDicomData::getImageNumber ( ) const

Returns the image number.

◆ getImagePosition()

SbVec3f SoVRDicomData::getImagePosition ( ) const

Returns the position of the first frame's top left voxel center in the patient space.

This correspond to Dicom tag ImagePositionPatient (0020, 0032) of image stack first slice.

◆ getImageWidth()

int SoVRDicomData::getImageWidth ( ) const

Returns the image width.

◆ getIntercept()

float SoVRDicomData::getIntercept ( ) const

Returns the intercept.

◆ getNumFrames()

int SoVRDicomData::getNumFrames ( ) const

Returns the number of frames.

Currently an SoVRDicomData object corresponds to a single DICOM file. Therefore getNumFrames() returns the number of images in the associated DICOM file, not (in general) the number of images in the volume. Typically it returns 1 because there is a single image in the file. Note that even if the SoVRDicomData object was queried from an SoVRDicomFileReader, it does not return the number of images in the volume except in the special case where all images are stored in a single file. To get the number of images in the volume use the volume reader or SoVolumeData object.

◆ getOrientation()

SbBool SoVRDicomData::getOrientation ( SbMatrix orientation) const

Returns the orientation of the DICOM volume.

This orientation can be used with a transform node, for example SoRotation It is computed from the DICOM Image Orientation Patient. If this element is not available, orientation will be set to the identity matrix.

Returns
True if file contains orientation information.

◆ getPosition()

SbBool SoVRDicomData::getPosition ( SbVec3f position) const

Returns the 3D position of the center of the image.

This position represents the "origin" of the image in a 3D graphics sense and be used with a transform node, for example, SoTranslation. It is computed from the DICOM Image Position Patient attribute, but is not the same as the Image Position Patient (which is the position of the center of the first voxel). If this element is not available, position will be set to (0, 0, 0).

Returns
True if file contains position

◆ getSamplesPerPixel()

int SoVRDicomData::getSamplesPerPixel ( ) const

Returns the number of samples per pixel.

◆ getSeriesNumber()

int SoVRDicomData::getSeriesNumber ( ) const

Returns the series number.

◆ getSizeInBytes()

int SoVRDicomData::getSizeInBytes ( ) const

Returns the image size in bytes.

◆ getSliceLocation()

float SoVRDicomData::getSliceLocation ( ) const

Returns the image location in mm.

This is the DICOM ImagePosition transformed by the DICOM ImageOrientation.

◆ getSliceSpacing()

float SoVRDicomData::getSliceSpacing ( ) const

Returns the slice spacing.

◆ getSliceThicknessMM()

float SoVRDicomData::getSliceThicknessMM ( ) const

Returns the slice thickness in mm.

If the thickness information is not present in the file, will return NaN.

◆ getSlope()

float SoVRDicomData::getSlope ( ) const

Returns the slope.

◆ getXPixelSize()

float SoVRDicomData::getXPixelSize ( ) const

Returns the X pixel size in mm.

◆ getYPixelSize()

float SoVRDicomData::getYPixelSize ( ) const

Returns the Y pixel size in mm.

◆ readDicomHeader() [1/2]

SoNONUNICODE SbBool SoVRDicomData::readDicomHeader ( const char *  fileName)

Reads the DICOM file header.

Returns TRUE upon success.

Non Unicode: This function should not be used in a Unicode application.

◆ readDicomHeader() [2/2]

SbBool SoVRDicomData::readDicomHeader ( const SbString fileName)

Reads the DICOM file header.

Returns TRUE upon success.

◆ readDicomImage() [1/2]

SoNONUNICODE SbBool SoVRDicomData::readDicomImage ( const char *  fileName)

Reads the DICOM image.

Returns TRUE upon success.

Non Unicode: This function should not be used in a Unicode application.

◆ readDicomImage() [2/2]

SbBool SoVRDicomData::readDicomImage ( const SbString fileName)

Reads the DICOM image.

Returns TRUE upon success.

◆ readFrame()

void SoVRDicomData::readFrame ( size_t  frame,
const SbBox2i32 subImg,
uint8_t *  dst 
) const

Read a region of a DICOM frame.

Parameters
frameThe frame to read. Note there is typically only one frame per file (see getNumFrames).
subImgA region of the frame to read (see getImageWidth() and getImageHeight()).
dstA buffer that will be filled with image data (see getSizeInBytes()).

NOTE: The application is responsible for allocating and freeing this memory.

◆ signedData()

int SoVRDicomData::signedData ( ) const

Returns the signed flag.

◆ supportedTransferSyntax()

SbBool SoVRDicomData::supportedTransferSyntax ( ) const

Returns true if the transfer syntax is supported by Open Inventor.

Friends And Related Symbol Documentation

◆ SoVRDicomFileReader

friend class SoVRDicomFileReader
friend

Definition at line 247 of file SoVRDicomData.h.


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