DICOM data. More...
#include <VolumeViz/readers/SoVRDicomData.h>
Public Member Functions | |
SoVRDicomData () | |
~SoVRDicomData () | |
SoNONUNICODE SbBool | readDicomHeader (const char *fileName) |
SbBool | readDicomHeader (const SbString &fileName) |
SoNONUNICODE SbBool | readDicomImage (const char *fileName) |
SbBool | readDicomImage (const SbString &fileName) |
SbBool | close () |
int | getNumFrames () const |
int | getImageWidth () const |
int | getImageHeight () const |
int | getSizeInBytes () const |
int | getBytesPerPixel () const |
int | getSamplesPerPixel () const |
SbBool | supportedTransferSyntax () const |
void | readFrame (size_t frame, const SbBox2i32 &subImg, uint8_t *dst) const |
const SiDicomDataSet * | getDicomDataSet () const |
float | getSliceThicknessMM () const |
float | getSliceSpacing () const |
int | getSeriesNumber () const |
int | getImageNumber () const |
float | getSliceLocation () const |
float | getXPixelSize () const |
float | getYPixelSize () const |
SbBool | getPosition (SbVec3f &position) const |
SbVec3f | getImagePosition () const |
SbBool | getOrientation (SbMatrix &orientation) const |
int | getBitsStored () const |
int | getHighBit () const |
int | signedData () const |
float | getIntercept () const |
float | getSlope () const |
SbString | getDicomInfo (unsigned short group, unsigned short element) const |
Friends | |
class | SoVRDicomFileReader |
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.
SoVRDicomFileReader, SiDicomDataSet
SoVRDicomData::SoVRDicomData | ( | ) |
Constructor.
SoVRDicomData::~SoVRDicomData | ( | ) |
Destructor.
SbBool SoVRDicomData::close | ( | ) |
Closes the underlying reader.
int SoVRDicomData::getBitsStored | ( | ) | const |
Returns the number of bits stored.
int SoVRDicomData::getBytesPerPixel | ( | ) | const |
Returns the number of bytes per pixel.
const SiDicomDataSet* SoVRDicomData::getDicomDataSet | ( | ) | const |
Returns a DICOM data object that allows accessing all the DICOM attributes.
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.
group | hexadecimal group tag value to retrieve info from. | |
element | hexadecimal element tag value to retrieve info from in the group. |
int SoVRDicomData::getHighBit | ( | ) | const |
Returns the high bit.
int SoVRDicomData::getImageHeight | ( | ) | const |
Returns the image height.
int SoVRDicomData::getImageNumber | ( | ) | const |
Returns the image number.
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.
int SoVRDicomData::getImageWidth | ( | ) | const |
Returns the image width.
float SoVRDicomData::getIntercept | ( | ) | const |
Returns the intercept.
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.
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 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).
int SoVRDicomData::getSamplesPerPixel | ( | ) | const |
Returns the number of samples per pixel.
int SoVRDicomData::getSeriesNumber | ( | ) | const |
Returns the series number.
int SoVRDicomData::getSizeInBytes | ( | ) | const |
Returns the image size in bytes.
float SoVRDicomData::getSliceLocation | ( | ) | const |
Returns the image location in mm.
This is the DICOM ImagePosition transformed by the DICOM ImageOrientation.
float SoVRDicomData::getSliceSpacing | ( | ) | const |
Returns the slice spacing.
float SoVRDicomData::getSliceThicknessMM | ( | ) | const |
Returns the slice thickness in mm.
If the thickness information is not present in the file, will return NaN.
float SoVRDicomData::getSlope | ( | ) | const |
Returns the slope.
float SoVRDicomData::getXPixelSize | ( | ) | const |
Returns the X pixel size in mm.
float SoVRDicomData::getYPixelSize | ( | ) | const |
Returns the Y pixel size in mm.
Reads the DICOM file header.
Returns TRUE upon success.
SoNONUNICODE SbBool SoVRDicomData::readDicomHeader | ( | const char * | fileName | ) |
Reads the DICOM file header.
Returns TRUE upon success.
Reads the DICOM image.
Returns TRUE upon success.
SoNONUNICODE SbBool SoVRDicomData::readDicomImage | ( | const char * | fileName | ) |
Reads the DICOM image.
Returns TRUE upon success.
void SoVRDicomData::readFrame | ( | size_t | frame, | |
const SbBox2i32 & | subImg, | |||
uint8_t * | dst | |||
) | const |
Read a region of a DICOM frame.
frame | The frame to read. Note there is typically only one frame per file (see getNumFrames). | |
subImg | A region of the frame to read (see getImageWidth() and getImageHeight()). | |
dst | A buffer that will be filled with image data (see getSizeInBytes()). |
NOTE: The application is responsible for allocating and freeing this memory.
int SoVRDicomData::signedData | ( | ) | const |
Returns the signed flag.
SbBool SoVRDicomData::supportedTransferSyntax | ( | ) | const |
Returns true if the transfer syntax is supported by Open Inventor.
friend class SoVRDicomFileReader [friend] |