Trispark JDT
2.50.13

com.archimed.dicom
Class Offsets

java.lang.Object
  extended by com.archimed.dicom.Offsets

public class Offsets
extends java.lang.Object

This class provides utilities to calculate offsets on a DicomObject that is going to be written. Note that these offsets will be invalid if you specify the wrong transfer syntax, ... Addition of data elements will sometimes invalidate these calculated offsets.

Since:
1.0

Field Summary
protected  JdtLogger log
           
 
Constructor Summary
Offsets(DicomObject dcm)
           
 
Method Summary
 long calculateOffset_ge(DicomObject d, int g, int e, int ts, boolean seq_undef, boolean grouplens, boolean file)
          Calculate an offset using (group, element) - pair in stead of DDict name.
 long calculateOffset_ge(int g, int e, int ts, boolean seq_undef, boolean grouplens, boolean file)
          This method calculates the offset of a data element, starting from the very first byte of the Dicom file.
 long calculateOffset(int dct, int ts, boolean seq_undef, boolean grouplens, boolean file)
          This method calculates the offset of a certain data element 'dct'.
 long calculateOffset(int seq, int i, int ts, boolean seq_undef, boolean grouplens, boolean file)
          This method calculates and returns the offset of an item in a sequence
 long calculateOffset(int seq, int i, int dct, int ts, boolean seq_undef, boolean grouplens, boolean file)
          This method calculates and returns the offset of a data element which is containded in an item of a sequence
 long calculateSize(boolean groupLengths, int transferSyntax, boolean seqUndefined)
          Calculates the size of the dicom object using the write options specified.
 void updateSequenceItemOffsets(int ts, boolean seq_undef, boolean grouplens, boolean file)
          updates the offset property of all sequence items that are one level deep to what would be the current offset from the beginning of the stream if the DicomObject would be written with its current contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected JdtLogger log
Constructor Detail

Offsets

public Offsets(DicomObject dcm)
Method Detail

updateSequenceItemOffsets

public void updateSequenceItemOffsets(int ts,
                                      boolean seq_undef,
                                      boolean grouplens,
                                      boolean file)
updates the offset property of all sequence items that are one level deep to what would be the current offset from the beginning of the stream if the DicomObject would be written with its current contents. This method takes into account file meta information and preamble, transfer syntax, presence of group length data elements and is useful for obtaining offsets of Directory Record Sequence Items in the construction of a DICOMDIR. The offsets can be obtained with the getOffset method of DicomObject.


calculateSize

public long calculateSize(boolean groupLengths,
                          int transferSyntax,
                          boolean seqUndefined)
Calculates the size of the dicom object using the write options specified. The size calculation does not include file meta information.

Parameters:
groupLengths - indicates if grouplengths should be added to the size
transferSyntax - transfer syntax that has to be used to calculate the size
seqUndefined - indicates how sequence items will be encoded
Returns:
the size of the dicom object

calculateOffset_ge

public long calculateOffset_ge(DicomObject d,
                               int g,
                               int e,
                               int ts,
                               boolean seq_undef,
                               boolean grouplens,
                               boolean file)
Calculate an offset using (group, element) - pair in stead of DDict name.


calculateOffset_ge

public long calculateOffset_ge(int g,
                               int e,
                               int ts,
                               boolean seq_undef,
                               boolean grouplens,
                               boolean file)
This method calculates the offset of a data element, starting from the very first byte of the Dicom file. To calculate this correctly, this method must know what parameters will be used for writing:

Parameters:
g - the group of the data element
e - the element of the data element
ts - the transfer syntax that will be used for writing this DicomObject
seq_undef - what kind of sequence encoding will be used when writing this DicomObject
grouplens - boolean indicating whether grouplengths will be written
file - will the DicomObject be written as a file or a stream ?

calculateOffset

public long calculateOffset(int dct,
                            int ts,
                            boolean seq_undef,
                            boolean grouplens,
                            boolean file)
This method calculates the offset of a certain data element 'dct'. See also calculateOffset_ge(g, e, ts, seq_undef, grouplens, file)

Parameters:
dct - the name of the data element

calculateOffset

public long calculateOffset(int seq,
                            int i,
                            int ts,
                            boolean seq_undef,
                            boolean grouplens,
                            boolean file)
This method calculates and returns the offset of an item in a sequence

Parameters:
seq - name of the sequence
i - number of the item (numbering starts with 0)

calculateOffset

public long calculateOffset(int seq,
                            int i,
                            int dct,
                            int ts,
                            boolean seq_undef,
                            boolean grouplens,
                            boolean file)
This method calculates and returns the offset of a data element which is containded in an item of a sequence

Parameters:
seq - name of the sequence
i - number of the item (numbering starts with 0)
dct - name of the data element

Trispark JDT
2.50.13

Copyright © 1999-2008 Trispark. All Rights Reserved.