SoVRDicomFileReader Class Reference

VolumeViz DICOM file reader. More...

#include <VolumeViz/readers/SoVRDicomFileReader.h>

Inheritance diagram for SoVRDicomFileReader:
SoVolumeReader SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Public Member Functions

virtual SoType getTypeId () const
 SoVRDicomFileReader ()
virtual int setFilename (const SbString &filename)
int setFilenameList (const SbStringList &filenameList)
SbBool setFilenameList (const SbString &format, const int startIndex=0, const int endIndex=INT_MAX, const int indexStep=1)
SbBool setDirectory (const SbString &folder)
virtual ReadError getDataChar (SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim)
virtual SbBool setOutputDataType (SbBool doChange, SoDataSet::DataType type)
virtual void getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, void *data)
int getNumSignificantBits ()
virtual ReaderType getReaderType ()
const SoVRDicomDatagetDicomData () const
virtual SbBool isThreadSafe () const

Static Public Member Functions

static SoType getClassTypeId ()

Detailed Description

VolumeViz DICOM file reader.

Volume reader for the DICOM file format. VolumeViz automatically selects this reader if a filename is given and the file extension is ".dc3", ".dic", ".dcm", or ".dicom".

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

SoVRDicomFileReader can load a volume from a single DICOM file or from a list of DICOM files (stack of images). Loading a volume from a single DICOM file is the same as loading any other format supported by VolumeViz. Loading a volume from a list of DICOM files can be done using a list file or by specifying a list of filenames. Using a list file is the same as loading a stack of images using the SoVRRasterStackReader except the list file should not contain any header. Each line in the list file may be a full path containing directory names or a simple file name. Simple file names are assumed to be in the same directory as the list file. The application can also specify a list of file paths using the setFilenameList() method. This is useful, for example, if the application user is allowed to select a list of files in a file selection dialog.

Unlike a raster stack, the position of each slice in a DICOM volume is determined by the location value in its file header and not by the order of the file name in the list. Also unlike a raster stack consisting of (for example) JPEG or PNG images, a DICOM file in the list may contain more than one slice of the volume. The reader handles this automatically. The first file in the list is considered the "reference" for the volume and all slices must be compatible with this one. Specifically this means that subsequent files must have the same width, height, data type and so on.

Note when using a list file: If the file extension is not ".dc3", ".dic" or ".dicom" VolumeViz will not automatically select the DICOM volume reader. You can either give the list file one of the DICOM file extensions or force VolumeViz to use the DICOM reader by explicitly creating an instance of SoVRDicomFileReader and calling the SoVolumeData method setReader().

The volume reader will automatically get the volume dimensions, data type, extent (voxel size/spacing) and number of significant bits from the DICOM file header. The reader will also apply the data adjustment (if any) specified by the RescaleSlope and RescaleIntercept tags in the DICOM file header, i.e.: actualValue = slope * storedValue + intercept. As part of this process the reader will automatically convert unsigned data to the corresponding signed data type if necessary (in other words if the rescale calculation produces negative values). The application can also explicitly specify the volume data type. This allows, for example, converting float data values to more compact integer values. Note: The DICOM reader only uses the rescale slope and intercept values from the first file in the list. It does not currently handle the (less common) case where each file contains different rescale values.

Volume extent:
The volume reader will compute the volume's width in X and height in Y from the volume dimensions and the voxel size. For example, if the volume dimension in X is 512 (voxels) and the voxel size in X is 0.408 mm, then the volume width is (approximately) 209 mm. The reader will compute the volume's depth in Z from the min and max slice locations specified in the file header(s). Note that the volume extent set by the reader is always centered at 0,0,0 in 3D world coordinates. For example the min and max X values in the extent box are exactly -width/2 and +width/2 (-104.5 mm and +104.5 mm in the previous example). The reader does not consider the DICOM volume origin (ImagePositionPatient) when setting the volume extent.

Coordinate Systems:
In a medical imaging application there are at least three related coordinate systems.

In other words, the default camera view is looking at the top of the head with the body “face down”.

DICOM specific information can be extracted using getDicomData() and the SoVRDicomData class.



Constructor & Destructor Documentation

SoVRDicomFileReader::SoVRDicomFileReader (  ) 


Member Function Documentation

static SoType SoVRDicomFileReader::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoVolumeReader.

virtual ReadError SoVRDicomFileReader::getDataChar ( SbBox3f size,
SoDataSet::DataType type,
SbVec3i32 dim 
) [virtual]

Gets the characteristics (file header) of the data volume.

See SoVolumeData. size is the size of the actual volume. type is the type of the data. dim is the dimension of the data.

Implements SoVolumeReader.

const SoVRDicomData& SoVRDicomFileReader::getDicomData (  )  const

Returns an instance of SoVRDicomData for the current file.

This object can be queried for DICOM specific info, using for example the SoVRDicomData::getDicomInfo() method.

int SoVRDicomFileReader::getNumSignificantBits (  )  [virtual]

This method is optional.

It returns the number of significant bits of the volume data.

If it is not implemented, the default return value is 0, meaning the number of bits depends on the data type. See the last parameter of SoVolumeData::setVolumeData(). This method is called immediately after getDataChar().

Reimplemented from SoVolumeReader.

virtual ReaderType SoVRDicomFileReader::getReaderType (  )  [inline, virtual]

Returns the reader type.

Reimplemented from SoVolumeReader.

virtual void SoVRDicomFileReader::getSubSlice ( const SbBox2i32 subSlice,
int  sliceNumber,
void *  data 
) [virtual]

New method required by VolumeViz 3.0 when using large volume support.

Must copy a rectangular part of an XY slice to the memory specified by data. Slices will not always be read sequentially.

Implements SoVolumeReader.

virtual SoType SoVRDicomFileReader::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoVolumeReader.

virtual SbBool SoVRDicomFileReader::isThreadSafe (  )  const [virtual]

SoVRDicomFileReader is trhead safe.

Reimplemented from SoVolumeReader.

SbBool SoVRDicomFileReader::setDirectory ( const SbString folder  ) 

Specify a directory containing DICOM files to load.

Each file in this folder that has a supported extension (currently ".dc3", ".dic", ".dcm", or ".dicom") will be loaded. If the DICOM files have an unsupported extension, use the setFilenameList function instead.

All the DICOM files in the specified directory should be part of the same volume data set. If not, the results are undefined.

folder The folder from which to load files.
true if successful.
Since Open Inventor 9.4.1

virtual int SoVRDicomFileReader::setFilename ( const SbString filename  )  [virtual]

Specify the name of a DICOM file or a file containing a list of DICOM files to load.

The list file should contain one filename per line. If the filenames in the list do not contain any slash or backslash characters, the files are assumed to be in the same directory as the list file. All the specified files should be part of the same volume data set. Returns 0 if successful.

Reimplemented from SoVolumeReader.

SbBool SoVRDicomFileReader::setFilenameList ( const SbString format,
const int  startIndex = 0,
const int  endIndex = INT_MAX,
const int  indexStep = 1 

Specify a list of DICOM files to load, using a sprintf-like format.

This will iterate from startIndex to endIndex (included) with increment of indexStep. For each step, this will add a file of name f, where f is format sprintf-ed with the current iteration index. All the specified files should be part of the same volume data set.

format The format of the file name, which must be an absolute file path.
e.g. "c:/testData/Brain.%04d.dcm", where "%04d" will be replaced by the current index, producing "c:/testData/Brain.0000.dcm" and so on.
startIndex The index of the first file to add
endIndex The index of the last file to add
indexStep the stride to use (e.g. 2 will skip one out of two files, by generating indices 0, 2, 4, ...)
true if successful.
Since Open Inventor 9.4.1

int SoVRDicomFileReader::setFilenameList ( const SbStringList filenameList  ) 

Specify a list of DICOM files to load.

All the specified files should be part of the same volume data set. Returns 0 if successful.

Since Open Inventor 9.0

virtual SbBool SoVRDicomFileReader::setOutputDataType ( SbBool  doChange,
SoDataSet::DataType  type 
) [virtual]

Requests that the input be converted (if necessary) to the specified data type.

This allows, for instance, conversion of float data to unsigned byte. By default no conversion is done. If doChange is FALSE no type conversion is done. Always returns TRUE.

Reimplemented from SoVolumeReader.

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

Open Inventor by FEI reference manual, generated on 21 Sep 2015
Copyright © FEI S.A.S. All rights reserved.