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

VolumeViz DICOM file reader. More...

#include <VolumeViz/readers/SoVRDicomFileReader.h>

+ Inheritance diagram for SoVRDicomFileReader:

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoVRDicomFileReader ()
 Constructor.
 
virtual int setFilename (const SbString &filename)
 Specify the name of a DICOM file or a file containing a list of DICOM files to load.
 
int setFilenamePattern (const SbString &pattern)
 Specify a pattern of DICOM files to load.
 
int setFilenameList (const SbStringList &filenameList)
 Specify a list of DICOM files to load.
 
SbBool 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.
 
bool setFilenameListFromSeries (const SbString &base)
 Specify a DICOM file and load all image files in the same directory that are part of the same "series" based on the series UID (0x0020,0x000E).
 
void loadInMemory ()
 Load the DICOM data into contiguous memory if possible.
 
SbBool setDirectory (const SbString &folder)
 Specify a directory containing DICOM files to load.
 
virtual ReadError getDataChar (SbBox3f &size, SoDataSet::DataType &type, SbVec3i32 &dim) override
 Gets the characteristics (file header) of the data volume.
 
virtual SbBool setOutputDataType (SbBool doChange, SoDataSet::DataType type)
 Requests that the input be converted (if necessary) to the specified data type.
 
virtual void getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, void *data)
 Must copy the rectangular part defined by subSlice of the XY slice sliceNumber to the memory referenced by data.
 
int getNumSignificantBits ()
 This method is optional.
 
virtual SoVolumeReader::ReaderType getReaderType ()
 Returns the reader type.
 
const SoVRDicomDatagetDicomData () const
 Returns an instance of SoVRDicomData for the first image of this volume.
 
const SiDicomDataSetgetDicomDataSet (const size_t sliceIdx) const
 Returns a DICOM data object for the specified slice containing all the DICOM attributes.
 
void loadSliceDicomData (int slice, SoVRDicomData &dicomData) const
 Loads the Dicom data of the given slice.
 
virtual SbBool isThreadSafe () const
 SoVRDicomFileReader is thread safe.
 
virtual void closeAllHandles ()
 Close all file handles currently opened by the reader.
 
virtual void restoreAllHandles ()
 Restore all file handles closed by closeAllHandles method.
 
- Public Member Functions inherited from SoVolumeReader
 SoVolumeReader ()
 Constructor.
 
virtual SbBool setInputDataRange (SbBool doChange, double min, double max)
 Requests that the input be converted from the specified range to the range depending on the output data type.
 
virtual void getSubSlice (const SbBox2i32 &subSlice, int sliceNumber, SoBufferObject *dataBuffer)
 Same as getSubSlice( const SbBox2i32& subSlice, int sliceNumber, void * data ) but using an SoBufferObject as the target of the data.
 
SbVec3i32 getNumVoxels (const SbVec3i32 &realSize, const SbVec3i32 &subsamplingLevel)
 Utility function provided by SoVolumeReader for subclass readers to call.
 
SbVec3i32 getSizeToAllocate (const SbVec3i32 &realSize, const SbVec3i32 &subsamplingLevel)
 Utility function provided by SoVolumeReader for subclass readers to call.
 
SbString getFilename () const
 Returns the path of the file.
 
virtual SbBool isDataConverted () const
 Returns TRUE if the data is already organized in tiles for the LDM module.
 
virtual void reloadTileMinMax ()
 
virtual SbBool getTileSize (SbVec3i32 &size)
 Returns tile dimensions in voxels when using data stored in tiles.
 
virtual SoBufferObjectreadTile (int index, const SbBox3i32 &tilePosition)
 Given an index, reads a tile if the data is organized in tiles (for LDM).
 
virtual SbBool readXTraceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const SbVec2i32 &tracePosition)
 Read directly from the data source, a trace inside a tile.
 
virtual SbBool readYSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition)
 Read directly from the data source, an orthoslice on the Y axis (Zaxis == 1) inside a tile.
 
virtual SbBool readZSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition)
 Read directly from the data source, an orthoslice on the Z axis (Zaxis == 2) inside a tile.
 
virtual SbBool readXSliceInTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition, const uint32_t &slicePosition)
 Read directly from the data source, an orthoslice on the X axis (Zaxis == 0) inside a tile.
 
virtual SbBool isIgnoredFile () const
 Should return TRUE if at least one file has been ignored during reading.
 
virtual SbString getOriginalFilename () const
 Returns original file name from which the data has been converted to LDM format if stored in file.
 
virtual SbBool getMinMax (int64_t &min, int64_t &max)
 Returns min and max for integer data type, if available.
 
virtual SbBool getMinMax (double &min, double &max)
 Returns min max for float data type, if available.
 
virtual SbBool getHistogram (std::vector< int64_t > &numVox)
 Returns histogram if available.
 
virtual SbBool setDirectCoordSysAutoDetection (SbBool autoValue)
 Sets whether or not the reader should automatically try to detect if the coordinate system used is direct or not.
 
virtual SbBool getDirectCoordSysAutoDetection ()
 Return automatic detection value.
 
virtual SbBool setDirectCoorSys (SbBool directCoord)
 Specify if the coordinate system used is direct or not.
 
virtual SbBool getDirectCoordSys ()
 Return whether the coordinate system used is direct or not.
 
virtual SbVec2d getTileMinMax (int index) const
 Returns the minimum and maximum data values for the given tile.
 
virtual SoVolumeWritergetConfiguredWriter ()
 Returns a volume writer that corresponds to this reader
(same format, parameters, etc).
 
CoordinateType getCoordinateType ()
 Returns coordinate type used by the data set.
 
const float * getRectilinearCoordinates (Axis axis) const
 Returns the coordinates for the specified axis.
 
void setRectilinearCoordinates (const float *x, const float *y, const float *z)
 Sets rectilinear coordinates for the data set.
 
virtual SbBool isRGBA () const
 Returns TRUE if the data set contains RGBA color values.
 
void setRGBA (const SbBool flag)
 Specifies if data must be considered as RGBA.
 
virtual SoDEPRECATED SbBool readTile (int index, unsigned char *&buffer, const SbBox3i32 &tilePosition)
 Given an index, reads a tile if the data is organized in tiles (for LDM).
 
virtual SoDEPRECATED SbBool readTile (int index, SoBufferObject *buffer, const SbBox3i32 &tilePosition)
 Same as readTile(int index, unsigned char*& buffer, const SbBox3i32& tilePosition) but using an SoBufferObject (allocated by LDM) as the target of the data.
 
virtual SoDEPRECATED int getBorderFlag ()
 Returns border (overlap) value if stored in file.
 
virtual SoDEPRECATED SbBool getMinMax (int &min, int &max)
 Returns min max if stored in file.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoVolumeReader
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SoVolumeReadergetAppropriateReader (const SbString &filename)
 Returns a preconfigured SoVolumeReader instance that can be used to load the given file (based on the filename extension).
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Additional Inherited Members

- Public Types inherited from SoVolumeReader
enum  ReadError {
  RD_NO_ERROR ,
  RD_FILE_NOT_FOUND_ERROR ,
  RD_INVALID_DATA_ERROR ,
  RD_UNSUPPORTED_DATA_TYPE_ERROR ,
  RD_FILE_FORMAT_NOT_VALID_ERROR ,
  RD_UNKNOWN_ERROR
}
 Read error. More...
 
enum  Axis {
  X ,
  Y ,
  Z
}
 Which axis to handle. More...
 
enum  ReaderType {
  NO_READER ,
  AM ,
  AVS ,
  DICOM ,
  GENERIC ,
  LDM ,
  MEMORY ,
  RASTERSTACK ,
  SEGY ,
  VOL ,
  VOX ,
  TIFF ,
  MRC
}
 Available reader type. More...
 
enum  CoordinateType {
  COORDINATES_UNIFORM = 0 ,
  COORDINATES_RECTILINEAR
}
 Coordinate type used by this data set. More...
 
- Protected Member Functions inherited from SoVolumeReader
virtual ~SoVolumeReader ()
 Destructor.
 
void * getBuffer (int64_t offset, unsigned int size)
 Returns a pointer to a buffer of size bytes corresponding to a part of the file at offset bytes from the beginning of the file.
 
int64_t fileSize ()
 Returns the size of the file when file I/O is handled by this class.
 
- Static Protected Member Functions inherited from SoVolumeReader
static bool registerVolumeReaderExtension (const SbString &fileExtension, const SoType &readerType)
 Register an SoVolumeReader class to handle a file extension.
 
static bool unregisterVolumeReaderExtensions (const SoType &readerType)
 Unregister all filename extensions associated with the specified SoVolumeReader class.
 
static int bytesToInt (const unsigned char *ptr, int sizeBytes)
 Utility method that returns an integer from sizeBytes bytes starting at address ptr.
 
static void swapBytes (int *intPtr, int sizeBytes)
 Utility method to convert an integer into the correct architecture (little/big endian).
 
static void swapBytesN (void *buffer, int numElements, int numBytesPerElement)
 Utility method to swap bytes of each element of an array of numElements elements.
 
static SbBool isValidFloat (const float val)
 Utility method to check if value is a valid IEEE 754 floating point number.
 
static SbBox3f adjustFlatExtent (const SbString &fileName, const SbBox3f &extent, const SbVec3i32 &dim)
 VolumeViz doesn't handles empty extent (for ex.
 
- Protected Attributes inherited from SoVolumeReader
SoDEPRECATED SbBool m_dataConverted
 

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) (http://medical.nema.org).

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 (see setFilename(const SbString& filename)). Loading a volume from a list of DICOM files can be done by:

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.

Photometric Interpretation:

  • MONOCHROME1 : Mapping of data values to color and opacity is defined by the SoDataRange and SoTransferFunction nodes. The application will normally use the DICOM Window Center and Window Width values to set the SoDataRange. For SoTransferFunction the application can use the predefined light to dark color map INTENSITY_REVERSED for displaying single images.
  • MONOCHROME2 : Mapping of data values to color and opacity is defined by the SoDataRange and SoTransferFunction nodes. The application will normally use the DICOM Window Center and Window Width values to set the SoDataRange. For SoTransferFunction the application can use the predefined dark to light color map INTENSITY for displaying single images.
  • PALETTE COLOR : The reader converts the data values to RGBA values using the palette lookup tables in the DICOM file and alpha = 1 (opaque). SoDataRange and SoTransferFunction have no effect on an RGBA volume.
  • RGB : The reader converts the RGB values to RGBA values with alpha = 1 (opaque). SoDataRange and SoTransferFunction have no effect on an RGBA volume.

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 for a DICOM data set, the volume 'position' is considered to be the center of the first voxel, however VolumeViz considers the volume extent (SoVolumeData::extent) to include all of the first and last voxels. Therefore the extent 'min' is alwaya the outside corner of the first voxel.

NOTE: By default, the reader does not consider the DICOM volume origin (Image Position Patient attribute) when setting the volume extent. The volume extent set by the reader is always centered at 0,0,0 in 3D world coordinates. There are two options to get the volume correctly positioned in 3D space:
  • Call the MedicalHelper method dicomAdjustVolume() after setting the files to be loaded. (Recommended)
  • Set the preference variable VOLUMEVIZ_CENTERED_DICOM to false (default is true).

Data Range:

Use an SoDataRange node to specify the actual (or desired) range of data values to be mapped. For example, a typical initial data range for DICOM data calibrated in Hounsfield units might be -1000 to 3000.

NOTE: By default, VolumeViz does not use the Window Center and Window Width values (if any) in the DICOM image file. Instead it maps the entire range of the voxel's data type (e.g. 0..65535 for unsigned short) into the colormap. There are two options to use the data range specified in the image file:

Coordinate Systems:

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

  • 3D world coordinates:
    Also called XYZ coordinates. This is the Cartesian coordinate system in which rendering objects (volumes, geometry), cameras, lights, etc. are positioned. In Open Inventor this is a right-handed coordinate system (same as OpenGL). The default camera creates a view look down the Z axis, i.e. +Z is toward the user, +X is to the right and +Y is up.
  • Voxel coordinates:
    Also called "IJK" coordinates. Each voxel's position in the volume can be described by an IJK coordinate. In VolumeViz this is also a right-handed coordinate system, corresponding to the positive XYZ axes, i.e. in the default camera's view K is toward the user, I is to the right and J is up. You can convert between IJK and XYZ coordinates based on the volume dimensions and extent or use the conversion methods provided in the SoVolumeData class, e.g. voxelToXYZ().
  • Anatomical coordinates: The three standard viewing planes are Axial, Coronal and Sagittal. The Axial plane divides the body into Superior (head) and Inferior (foot) sections. The Coronal plane is a vertical plane dividing the body into Anterior (front) and Posterior (back) sections. The Sagittal plane divides the body longitudinally into Right and Left sections. The orientation of the patient in a medical data set is often specified using three letters to identify the primary axes, where each letter is one of the section names.
    DICOM volumes typically have LPS (Left, Posterior, Superior) orientation. In this case VolumeViz considers that the direction:

    • Toward the left side of the body (Left) is the I / +X / Sagittal axis,
    • Toward the back of the body (Posterior) is the J / +Y / Coronal axis, and
    • Toward the head (Superior) is the K / +Z / Axial axis.

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

NOTE: By default Open Inventor does not display DICOM images with the usual orientation. A convenient way to get the standard DICOM view orientations is to use the MedicalHelper method orientView(). This method is useful for orienting the camera to view along one of the standard medical axes (Axial, Coronal or Sagittal).

When viewing a slice, also remember that the volume is always a 3D object to Open Inventor and you must also set the 'axis' field on the SoOrthoSlice node. See the dicomImageViewer example in the examples/source/Medical/Input directory.

DICOM Attributes

All DICOM attributes, including hierarchical data like Structured Reports, can be traversed and queried using SiDicomDataSet (see getDicomDataSet()). See the DicomSimpleViewer example in the examples/source/VolumeViz/examples directory.

SEE ALSO

SoVRDicomData, SiDicomDataSet

Definition at line 198 of file SoVRDicomFileReader.h.

Constructor & Destructor Documentation

◆ SoVRDicomFileReader()

SoVRDicomFileReader::SoVRDicomFileReader ( )

Constructor.

Member Function Documentation

◆ closeAllHandles()

virtual void SoVRDicomFileReader::closeAllHandles ( )
virtual

Close all file handles currently opened by the reader.

See also
restoreAllHandles

Reimplemented from SoVolumeReader.

◆ getClassTypeId()

static SoType SoVRDicomFileReader::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getDataChar()

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

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

See SoDataSet::setVolumeData().
You can use the convenience method setFilename() to specify the file location, in which case you will not have to open the file yourself. Then you can use the convenience method getBuffer() to read the header in order to get the requested information.

NOTE: We strongly recommend that readers implement this version of getDataChar, introduced in VolumeViz 5.1, because it uses SbVec3i32 for the volume dimension.

Implements SoVolumeReader.

◆ getDicomData()

const SoVRDicomData & SoVRDicomFileReader::getDicomData ( ) const

Returns an instance of SoVRDicomData for the first image of this volume.

Note that the first image of the volume does not necessarily correspond to first file of file list. Images are automatically sorted using the Image Postion Patient attribute.

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

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

◆ getDicomDataSet()

const SiDicomDataSet * SoVRDicomFileReader::getDicomDataSet ( const size_t  sliceIdx) const

Returns a DICOM data object for the specified slice containing all the DICOM attributes.

Parameters
sliceIdxThe index of the slice to extract the dataset from.
Returns
A pointer to a new dataset object, that must be deleted by the application. Returns NULL if an error occured.

◆ getNumSignificantBits()

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.

◆ getReaderType()

virtual SoVolumeReader::ReaderType SoVRDicomFileReader::getReaderType ( )
inlinevirtual

Returns the reader type.

Reimplemented from SoVolumeReader.

Definition at line 348 of file SoVRDicomFileReader.h.

◆ getSubSlice()

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

Must copy the rectangular part defined by subSlice of the XY slice sliceNumber to the memory referenced by data.

Slices will not always be read sequentially.

Parameters
subSlice2D region of the slice to return.
sliceNumberSlice number on the volume Z axis (first slice is 0).
dataCopy the data into this buffer.

You can use the convenience method getBuffer() to read data from file. Note: setFilename() must have been called previously.

Reimplemented from SoVolumeReader.

◆ getTypeId()

virtual SoType SoVRDicomFileReader::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoVolumeReader.

◆ isThreadSafe()

virtual SbBool SoVRDicomFileReader::isThreadSafe ( ) const
virtual

SoVRDicomFileReader is thread safe.

Reimplemented from SoVolumeReader.

◆ loadInMemory()

void SoVRDicomFileReader::loadInMemory ( )

Load the DICOM data into contiguous memory if possible.

Once the data is loaded, no additional file I/O is necessary and data access calls to the reader, e.g. getSubSlice(), will be fast.

Example:

volReader->setFilename( VOLUME_FILENAME );
volReader->loadInMemory();
SoVolumeData* volData = new SoVolumeData();
volData->setReader( *volReader );
static SbBool dicomAdjustVolume(SoVolumeData *volume, SbBool useImagePosition=TRUE)
Optimize volume data node for DICOM volumes.
void setReader(SoVolumeReader &reader, SbBool takeOwnership=FALSE)
This method allows the data to be read directly from the disk using the specified subclass of SoVolum...
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> DICOM file reader.
void loadInMemory()
Load the DICOM data into contiguous memory if possible.
virtual int setFilename(const SbString &filename)
Specify the name of a DICOM file or a file containing a list of DICOM files to load.
SoVRDicomFileReader()
Constructor.
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Volume data property ...

Notes:

  • This is a blocking call (does not return until all data is loaded).
  • It is not currently possible to directly access the data in memory.
  • It is not currently possible to monitor the progress of the data loading.
  • It is not currently possible to test if the data loading succeeded.
  • Do NOT call this method before setting the data source (filename or directory).
  • Do NOT call this method with an invalid data filename or directory.

Since Open Inventor 10.3

◆ loadSliceDicomData()

void SoVRDicomFileReader::loadSliceDicomData ( int  slice,
SoVRDicomData dicomData 
) const

Loads the Dicom data of the given slice.

To conveniently access the DICOM attributes, see getDicomDataSet method.

◆ restoreAllHandles()

virtual void SoVRDicomFileReader::restoreAllHandles ( )
virtual

Restore all file handles closed by closeAllHandles method.

See also
closeAllHandles

Reimplemented from SoVolumeReader.

◆ setDirectory()

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.

Parameters
folderThe folder from which to load files.
Returns
true if successful.

Since Open Inventor 9.4.1

◆ setFilename()

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.

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. All the specified files should be part of the same volume data set.

Returns 0 if successful.

Reimplemented from SoVolumeReader.

◆ setFilenameList() [1/2]

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.

Parameters
formatThe 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.
startIndexThe index of the first file to add
endIndexThe index of the last file to add
indexStepthe stride to use (e.g. 2 will skip one out of two files, by generating indices 0, 2, 4, ...)
Returns
true if successful.

Since Open Inventor 9.4.1

◆ setFilenameList() [2/2]

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.

Note: SbStringList is a list of pointers, not a list of objects, so the destructor for this class does not free the memory associated with the SbString objects. The application is responsible for deleting each object in the list.

Since Open Inventor 9.0

◆ setFilenameListFromSeries()

bool SoVRDicomFileReader::setFilenameListFromSeries ( const SbString base)

Specify a DICOM file and load all image files in the same directory that are part of the same "series" based on the series UID (0x0020,0x000E).

Parameters
baseThe path to a DICOM image file.
Returns
true if successful.

◆ setFilenamePattern()

int SoVRDicomFileReader::setFilenamePattern ( const SbString pattern)

Specify a pattern of DICOM files to load.

Parameters
patterne.g. "data_directory/image_file*.dcm"
Returns
0 if successful.

Since Open Inventor 9.8

◆ setOutputDataType()

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: