SoVRDicomFileReader Class |
DICOM file reader.
Namespace: OIV.VolumeViz.Readers
The SoVRDicomFileReader type exposes the following members.
Name | Description | |
---|---|---|
SoVRDicomFileReader | Constructor. |
Name | Description | |
---|---|---|
CloseAllHandles | Close all file handles currently opened by the reader. | |
CopyFieldValues(SoFieldContainer) | Calls CopyFieldValues(fc, false). (Inherited from SoFieldContainer.) | |
CopyFieldValues(SoFieldContainer, Boolean) | Copies the contents of fc's fields into this object's fields. | |
Dispose |
Releases all resources used by SoDisposable.
(Inherited from SoDisposable.) | |
EnableNotify | Notification at this Field Container is enabled (if flag == true) or disabled (if flag == false). | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
FieldsAreEqual | Returns true if this object's fields are exactly equal to fc's fields. | |
Get | Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string. | |
GetAllFields | Returns a list of fields, including the eventIn's and eventOut's. | |
GetBorderFlag | Obsolete. (Inherited from SoVolumeReader.) | |
GetConfiguredWriter | (Inherited from SoVolumeReader.) | |
GetCoordinateType | Returns coordinate type used by the data set. | |
GetDataChar | Gets the characteristics (file header) of the data volume. | |
GetDicomData | Returns an instance of OIV.VolumeViz.Readers.SoVRDicomData for the first image of this volume. | |
GetDicomDataSet | Returns a DICOM data object for the specified slice containing all the DICOM attributes. | |
GetDirectCoordSys | Return whether the coordinate system used is direct or not. | |
GetDirectCoordSysAutoDetection | Return automatic detection value. | |
GetEventIn | Returns a the eventIn with the given name. | |
GetEventOut | Returns the eventOut with the given name. | |
GetField | Returns a the field of this object whose name is fieldName. | |
GetFieldName | Returns the name of the given field in the fieldName argument. | |
GetFields | Appends references to all of this object's fields to resultList, and returns the number of fields appended. | |
GetFilename | Returns the path of the file. | |
GetHashCode |
Overrides GetHashCode().
(Inherited from SoNetBase.) | |
GetHistogram(IListInt64) | Returns histogram if available. | |
GetHistogram(Queue) | Obsolete.
Returns histogram if stored in file.
(Inherited from SoVolumeReader.) | |
GetMinMax(Double, Double) | Returns min max for float data type, if available. | |
GetMinMax(Int32, Int32) | Obsolete. (Inherited from SoVolumeReader.) | |
GetMinMax(Int64, Int64) | Returns min and max for integer data type, if available. | |
GetName | Returns the name of an instance. | |
GetNumSignificantBits | This method is optional. | |
GetNumVoxels | Utility function provided by OIV.LDM.Readers.SoVolumeReader for subclass readers to call. | |
GetOriginalFilename | Returns original file name from which the data has been converted to LDM format if stored in file. | |
GetReaderType | Returns the reader type. | |
GetRectilinearCoordinates | Returns the coordinates for the specified axis. | |
GetSizeToAllocate | Utility function provided by OIV.LDM.Readers.SoVolumeReader for subclass readers to call. | |
GetStringName | (Inherited from SoBase.) | |
GetSubSlice(SbBox2i32, Int32, SoBufferObject) | Same as OIV.LDM.Readers.SoVolumeReader.GetSubSlice(OIV.Inventor.SbBox2i32, System.Int32, OIV.Inventor.Generic.SbNativeArray{{System.Byte}}) but using an OIV.Inventor.Devices.SoBufferObject as the target of the data. | |
GetSubSlice(SbBox2i32, Int32, SbNativeArrayByte) | Must copy the rectangular part defined by subSlice of the XY slice sliceNumber to the memory referenced by data. | |
GetTileMinMax | Returns the minimum and maximum data values for the given tile. | |
GetTileSize | Returns tile dimensions in voxels when using data stored in tiles. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
HasDefaultValues | Returns true if all of the object's fields have their default values. | |
IsIgnoredFile | Should return true if at least one file has been ignored during reading. | |
IsNotifyEnabled | Notification is the process of telling interested objects that this object has changed. | |
IsSynchronizable | Gets the ScaleViz synchronizable state of this object. | |
LoadInMemory | Load the DICOM data into contiguous memory if possible. | |
LoadSliceDicomData | Loads the Dicom data of the given slice. | |
ReadTile(Int32, SbBox3i32) | Given an index, reads a tile if the data is organized in tiles (for LDM). | |
ReadTile(Int32, SoBufferObject, SbBox3i32) | Obsolete. Same as OIV.LDM.Readers.SoVolumeReader.ReadTile(System.Int32, OIV.Inventor.Generic.SbNativeArray{{System.Byte}}, OIV.Inventor.SbBox3i32) but using an OIV.Inventor.Devices.SoBufferObject (allocated by LDM) as the target of the data. | |
ReadTile(Int32, SbNativeArrayByte, SbBox3i32) | Obsolete. Given an index, reads a tile if the data is organized in tiles (for LDM). | |
ReadXSliceInTile | Read directly from the data source, an orthoslice on the X axis (Zaxis == 0) inside a tile. | |
ReadXTraceInTile | Read directly from the data source, a trace inside a tile. | |
ReadYSliceInTile | Read directly from the data source, an orthoslice on the Y axis (Zaxis == 1) inside a tile. | |
ReadZSliceInTile | Read directly from the data source, an orthoslice on the Z axis (Zaxis == 2) inside a tile. | |
ReloadTileMinMax | (Inherited from SoVolumeReader.) | |
RestoreAllHandles | Restore all file handles closed by closeAllHandles method. | |
Set | 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. | |
SetDirectCoordSysAutoDetection | Sets whether or not the reader should automatically try to detect if the coordinate system used is direct or not. | |
SetDirectCoorSys | Specify if the coordinate system used is direct or not. | |
SetDirectory | Specify a directory containing DICOM files to load. | |
SetFilename | Specify the name of a DICOM file or a file containing a list of DICOM files to load. | |
SetFilenameList(IListString) |
Specifies the list of a DICOM files to load.
| |
SetFilenameList(String) | Calls SetFilenameList(format, System.Int32(0), INT_MAX, 1). | |
SetFilenameList(String, Int32) | Calls SetFilenameList(format, startIndex, INT_MAX, 1). | |
SetFilenameList(String, Int32, Int32) | Calls SetFilenameList(format, startIndex, endIndex, 1). | |
SetFilenameList(String, Int32, Int32, Int32) | Specify a list of DICOM files to load, using a sprintf-like format. | |
SetFilenameListFromSeries | 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). | |
SetFilenamePattern | Specify a pattern of DICOM files to load. | |
SetInputDataRange | Requests that the input be converted from the specified range to the range depending on the output data type. | |
SetName | (Inherited from SoBase.) | |
SetOutputDataType | Requests that the input be converted (if necessary) to the specified data type. | |
SetRectilinearCoordinates | Sets rectilinear coordinates for the data set. | |
SetSynchronizable | Sets this to be a ScaleViz synchronizable object. | |
SetToDefaults | Sets all fields in this object to their default values. | |
SetUserData | Obsolete.
Stores the userData (for example the filename string) in the m_data protected variable.
(Inherited from SoVolumeReader.) | |
ToString |
Converts this SoBase structure to a human readable string.
(Inherited from SoBase.) | |
Touch | Marks an instance as modified, simulating a change to it. |
Name | Description | |
---|---|---|
DataConverted |
true if the data is already organized in tiles for the LDM module.
In other words, all drivers that directly support the GetTile() method should
set DataConverted to true.
If true, VolumeViz will use the ReadTile method and will NOT call GetSubSlice().
(Inherited from SoVolumeReader.) | |
IsDisposable | ISafeDisposable interface implementation.
(Inherited from SoDisposable.) | |
IsRGBA | Returns true if the data set contains RGBA color values. | |
IsThreadSafe | OIV.VolumeViz.Readers.SoVRDicomFileReader is thread safe. | |
UserData |
Gets or sets the user data to be contained by the field container.
(Inherited from SoFieldContainer.) |
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).
OIV.VolumeViz.Readers.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 OIV.VolumeViz.Readers.SoVRDicomFileReader.SetFilename(System.String)). Loading a volume from a list of DICOM files can be done by:
Using a list file. See OIV.VolumeViz.Readers.SoVRDicomFileReader.SetFilename(System.String).
Specifying an explicit list of filenames. See OIV.VolumeViz.Readers.SoVRDicomFileReader.SetFilename(System.String).
Specifying a list of filenames by simple pattern. See OIV.VolumeViz.Readers.SoVRDicomFileReader.SetFilenamePattern(System.String).
Specifying a list of filenames using a sprintf-like format. See OIV.VolumeViz.Readers.SoVRDicomFileReader.SetFilenameList(System.String, System.Int32, System.Int32, System.Int32).
Specifying a file and loading all images that are part of the same "series". See OIV.VolumeViz.Readers.SoVRDicomFileReader.SetFilenameListFromSeries(System.String).
Specifying a directory and loading all DICOM files in the directory. See OIV.VolumeViz.Readers.SoVRDicomFileReader.SetDirectory(System.String).
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 OIV.VolumeViz.Readers.SoVRDicomFileReader and calling the OIV.VolumeViz.Nodes.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 OIV.LDM.Nodes.SoDataRange and OIV.LDM.Nodes.SoTransferFunction nodes. The application will normally use the DICOM Window Center and Window Width values to set the OIV.LDM.Nodes.SoDataRange. For OIV.LDM.Nodes.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 OIV.LDM.Nodes.SoDataRange and OIV.LDM.Nodes.SoTransferFunction nodes. The application will normally use the DICOM Window Center and Window Width values to set the OIV.LDM.Nodes.SoDataRange. For OIV.LDM.Nodes.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). OIV.LDM.Nodes.SoDataRange and OIV.LDM.Nodes.SoTransferFunction have no effect on an RGBA volume.
RGB : The reader converts the RGB values to RGBA values with alpha = 1 (opaque). OIV.LDM.Nodes.SoDataRange and OIV.LDM.Nodes.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).
Use an OIV.LDM.Nodes.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:
Call the MedicalHelper method dicomAdjustDataRange(). (Recommended)
Query the Window Center and Window Width values using the MedicalHelper method getWindowCenterWidth().
Query the Window Center (0028,1050) and Window Width (0028,1051) values using using an OIV.VolumeViz.Readers.SoVRDicomData object (see OIV.VolumeViz.Readers.SoVRDicomFileReader.GetDicomData()) or an OIV.VolumeViz.Readers.Dicom.SiDicomDataSet object (see OIV.VolumeViz.Readers.SoVRDicomFileReader.GetDicomDataSet(System.UInt64)).
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 OIV.VolumeViz.Nodes.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 OIV.VolumeViz.Nodes.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 OIV.VolumeViz.Readers.Dicom.SiDicomDataSet (see OIV.VolumeViz.Readers.SoVRDicomFileReader.GetDicomDataSet(System.UInt64)). See the DicomSimpleViewer example in the examples/source/VolumeViz/examples directory.