Package be.uclouvain.orthanc
Class DicomInstance
- java.lang.Object
-
- be.uclouvain.orthanc.DicomInstance
-
public class DicomInstance extends java.lang.Object
DICOM instance managed by the Orthanc core
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DicomInstance(long self)
Construct a Java object wrapping a C object that is managed by Orthanc.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DicomInstance
createDicomInstance(byte[] buffer)
Parse a DICOM instance.void
dispose()
Manually deallocate the C object that is associated with this Java wrapper.protected void
finalize()
java.lang.String
getInstanceAdvancedJson(DicomToJsonFormat format, DicomToJsonFlags flags, int maxStringLength)
Format a DICOM memory buffer as a JSON string.Image
getInstanceDecodedFrame(int frameIndex)
Decode one frame from a DICOM instance.int
getInstanceFramesCount()
Get the number of frames in a DICOM instance.java.lang.String
getInstanceJson()
Get the DICOM tag hierarchy as a JSON file.java.lang.String
getInstanceMetadata(java.lang.String metadata)
Get the value of some metadata associated with a given DICOM instance.InstanceOrigin
getInstanceOrigin()
Get the origin of a DICOM file.byte[]
getInstanceRawFrame(int frameIndex)
Get the raw content of a frame in a DICOM instance.java.lang.String
getInstanceRemoteAet()
Get the AET of a DICOM instance.java.lang.String
getInstanceSimplifiedJson()
Get the DICOM tag hierarchy as a JSON file (with simplification).long
getInstanceSize()
Get the size of a DICOM file.java.lang.String
getInstanceTransferSyntaxUid()
Get the transfer syntax of a DICOM file.protected long
getSelf()
Return the C object that is associated with this Java wrapper.int
hasInstanceMetadata(java.lang.String metadata)
Check whether a DICOM instance is associated with some metadata.int
hasInstancePixelData()
Check whether the DICOM file has pixel data.byte[]
serializeDicomInstance()
Writes a DICOM instance to a memory buffer.static DicomInstance
transcodeDicomInstance(byte[] buffer, java.lang.String transferSyntax)
Parse and transcode a DICOM instance.
-
-
-
Method Detail
-
getSelf
protected long getSelf()
Return the C object that is associated with this Java wrapper.- Returns:
- Pointer to the C object.
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
dispose
public void dispose()
Manually deallocate the C object that is associated with this Java wrapper. This method can be used to immediately deallocate the C object, instead of waiting for the garbage collector to dispose the Java wrapper.
-
createDicomInstance
public static DicomInstance createDicomInstance(byte[] buffer)
Parse a DICOM instance. This function parses a memory buffer that contains a DICOM file. The function returns a new pointer to a data structure that is managed by the Orthanc core.- Parameters:
buffer
- The memory buffer containing the DICOM instance.- Returns:
- The newly constructed object.
-
transcodeDicomInstance
public static DicomInstance transcodeDicomInstance(byte[] buffer, java.lang.String transferSyntax)
Parse and transcode a DICOM instance. This function parses a memory buffer that contains a DICOM file, then transcodes it to the given transfer syntax. The function returns a new pointer to a data structure that is managed by the Orthanc core.- Parameters:
buffer
- The memory buffer containing the DICOM instance.transferSyntax
- The transfer syntax UID for the transcoding.- Returns:
- The newly constructed object.
-
getInstanceRemoteAet
public java.lang.String getInstanceRemoteAet()
Get the AET of a DICOM instance. This function returns the Application Entity Title (AET) of the DICOM modality from which a DICOM instance originates.- Returns:
- The resulting string.
-
getInstanceSize
public long getInstanceSize()
Get the size of a DICOM file. This function returns the number of bytes of the given DICOM instance.- Returns:
- The size of the file, -1 in case of error.
-
getInstanceJson
public java.lang.String getInstanceJson()
Get the DICOM tag hierarchy as a JSON file. This function returns a pointer to a newly created string containing a JSON file. This JSON file encodes the tag hierarchy of the given DICOM instance.- Returns:
- The resulting string.
-
getInstanceSimplifiedJson
public java.lang.String getInstanceSimplifiedJson()
Get the DICOM tag hierarchy as a JSON file (with simplification). This function returns a pointer to a newly created string containing a JSON file. This JSON file encodes the tag hierarchy of the given DICOM instance. In contrast with ::OrthancPluginGetInstanceJson(), the returned JSON file is in its simplified version.- Returns:
- The resulting string.
-
hasInstanceMetadata
public int hasInstanceMetadata(java.lang.String metadata)
Check whether a DICOM instance is associated with some metadata. This function checks whether the DICOM instance of interest is associated with some metadata. As of Orthanc 0.8.1, in the callbacks registered by ::OrthancPluginRegisterOnStoredInstanceCallback(), the only possibly available metadata are "ReceptionDate", "RemoteAET" and "IndexInSeries".- Parameters:
metadata
- The metadata of interest.- Returns:
- 1 if the metadata is present, 0 if it is absent, -1 in case of error.
-
getInstanceMetadata
public java.lang.String getInstanceMetadata(java.lang.String metadata)
Get the value of some metadata associated with a given DICOM instance. This functions returns the value of some metadata that is associated with the DICOM instance of interest. Before calling this function, the existence of the metadata must have been checked with ::OrthancPluginHasInstanceMetadata().- Parameters:
metadata
- The metadata of interest.- Returns:
- The resulting string.
-
getInstanceOrigin
public InstanceOrigin getInstanceOrigin()
Get the origin of a DICOM file. This function returns the origin of a DICOM instance that has been received by Orthanc.- Returns:
- The origin of the instance.
-
getInstanceTransferSyntaxUid
public java.lang.String getInstanceTransferSyntaxUid()
Get the transfer syntax of a DICOM file. This function returns a pointer to a newly created string that contains the transfer syntax UID of the DICOM instance. The empty string might be returned if this information is unknown.- Returns:
- The resulting string.
-
hasInstancePixelData
public int hasInstancePixelData()
Check whether the DICOM file has pixel data. This function returns a Boolean value indicating whether the DICOM instance contains the pixel data (7FE0,0010) tag.- Returns:
- "1" if the DICOM instance contains pixel data, or "0" if the tag is missing, or "-1" in the case of an error.
-
getInstanceFramesCount
public int getInstanceFramesCount()
Get the number of frames in a DICOM instance. This function returns the number of frames that are part of a DICOM image managed by the Orthanc core.- Returns:
- The number of frames (will be zero in the case of an error).
-
getInstanceRawFrame
public byte[] getInstanceRawFrame(int frameIndex)
Get the raw content of a frame in a DICOM instance. This function returns a memory buffer containing the raw content of a frame in a DICOM instance that is managed by the Orthanc core. This is notably useful for compressed transfer syntaxes, as it gives access to the embedded files (such as JPEG, JPEG-LS or JPEG2k). The Orthanc core transparently reassembles the fragments to extract the raw frame.- Parameters:
frameIndex
- The index of the frame of interest.- Returns:
- The resulting memory buffer.
-
getInstanceDecodedFrame
public Image getInstanceDecodedFrame(int frameIndex)
Decode one frame from a DICOM instance. This function decodes one frame of a DICOM image that is managed by the Orthanc core.- Parameters:
frameIndex
- The index of the frame of interest.- Returns:
- The newly constructed object.
-
serializeDicomInstance
public byte[] serializeDicomInstance()
Writes a DICOM instance to a memory buffer. This function returns a memory buffer containing the serialization of a DICOM instance that is managed by the Orthanc core.- Returns:
- The resulting memory buffer.
-
getInstanceAdvancedJson
public java.lang.String getInstanceAdvancedJson(DicomToJsonFormat format, DicomToJsonFlags flags, int maxStringLength)
Format a DICOM memory buffer as a JSON string. This function takes as DICOM instance managed by the Orthanc core, and outputs a JSON string representing the tags of this DICOM file.- Parameters:
format
- The output format.flags
- Flags governing the output.maxStringLength
- The maximum length of a field. Too long fields will be output as "null". The 0 value means no maximum length.- Returns:
- The resulting string.
-
-