Class SoVRDicomData
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.volumeviz.readers.SoVRDicomData
-
public class SoVRDicomData extends Inventor
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Constructor Summary
Constructors Constructor Description SoVRDicomData()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
close()
Closes the underlying reader.int
getBitsStored()
Returns the number of bits stored.int
getBytesPerPixel()
Returns the number of bytes per pixel.SiDicomDataSet
getDicomDataSet()
Returns a DICOM data object that allows accessing all the DICOM attributes.java.lang.String
getDicomInfo(short group, short element)
Generic method to get DICOM info.int
getHighBit()
Returns the high bit.int
getImageHeight()
Returns the image height.int
getImageNumber()
Returns the image number.SbVec3f
getImagePosition()
Returns the position of the first frame's top left voxel center in the patient space.int
getImageWidth()
Returns the image width.float
getIntercept()
Returns the intercept.int
getNumFrames()
Returns the number of frames.SbMatrix
getOrientation()
Returns the orientation of the DICOM volume.SbVec3f
getPosition()
Returns the 3D position of the center of the image.int
getSamplesPerPixel()
Returns the number of samples per pixel.int
getSeriesNumber()
Returns the series number.int
getSizeInBytes()
Returns the image size in bytes.float
getSliceLocation()
Returns the image location in mm.float
getSliceSpacing()
Returns the slice spacing.float
getSliceThicknessMM()
Returns the slice thickness in mm.float
getSlope()
Returns the slope.float
getXPixelSize()
Returns the X pixel size in mm.float
getYPixelSize()
Returns the Y pixel size in mm.boolean
readDicomHeader(java.lang.String fileName)
Reads the DICOM file header.boolean
readDicomImage(java.lang.String fileName)
Reads the DICOM image.int
signedData()
Returns the signed flag.boolean
supportedTransferSyntax()
Returns true if the transfer syntax is supported by Open Inventor.-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Method Detail
-
readDicomHeader
public boolean readDicomHeader(java.lang.String fileName)
Reads the DICOM file header. Returns true upon success.
-
getHighBit
public int getHighBit()
Returns the high bit.
-
getBitsStored
public int getBitsStored()
Returns the number of bits stored.
-
readDicomImage
public boolean readDicomImage(java.lang.String fileName)
Reads the DICOM image. Returns true upon success.
-
getOrientation
public SbMatrix getOrientation()
Returns the orientation of the DICOM volume. This orientation can be used with a transform node, for exampleSoRotation
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.
-
getSlope
public float getSlope()
Returns the slope.
-
getDicomInfo
public java.lang.String getDicomInfo(short group, short element)
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:
group
- hexadecimal group tag value to retrieve info from.element
- hexadecimal element tag value to retrieve info from in the group.- Returns:
- value info.
-
getDicomDataSet
public SiDicomDataSet getDicomDataSet()
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.
-
signedData
public int signedData()
Returns the signed flag.
-
getIntercept
public float getIntercept()
Returns the intercept.
-
getBytesPerPixel
public int getBytesPerPixel()
Returns the number of bytes per pixel.
-
getSeriesNumber
public int getSeriesNumber()
Returns the series number.
-
getSizeInBytes
public int getSizeInBytes()
Returns the image size in bytes.
-
getImageNumber
public int getImageNumber()
Returns the image number.
-
getSamplesPerPixel
public int getSamplesPerPixel()
Returns the number of samples per pixel.
-
getSliceThicknessMM
public float getSliceThicknessMM()
Returns the slice thickness in mm. If the thickness information is not present in the file, will return NaN.
-
getSliceSpacing
public float getSliceSpacing()
Returns the slice spacing.
-
supportedTransferSyntax
public boolean supportedTransferSyntax()
Returns true if the transfer syntax is supported by Open Inventor.
-
getPosition
public SbVec3f getPosition()
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
-
getNumFrames
public int getNumFrames()
Returns the number of frames. Currently anSoVRDicomData
object corresponds to a single DICOM file. ThereforegetNumFrames()
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 theSoVRDicomData
object was queried from anSoVRDicomFileReader
, 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 orSoVolumeData
object.
-
getImagePosition
public SbVec3f getImagePosition()
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.
-
close
public boolean close()
Closes the underlying reader.
-
getYPixelSize
public float getYPixelSize()
Returns the Y pixel size in mm.
-
getImageHeight
public int getImageHeight()
Returns the image height.
-
getSliceLocation
public float getSliceLocation()
Returns the image location in mm. This is the DICOM ImagePosition transformed by the DICOM ImageOrientation.
-
getImageWidth
public int getImageWidth()
Returns the image width.
-
getXPixelSize
public float getXPixelSize()
Returns the X pixel size in mm.
-
-