Class ContentItemFactory

java.lang.Object
com.pixelmed.dicom.ContentItemFactory

public class ContentItemFactory extends Object

A class with methods for constructing a ContentItem of the appropriate class from a list of attributes.

The sub-classes of ContentItem are public internal classes of this class, but specialize the methods, specifically the extractors and the string representation methods.

This is not an abstract class, and the content item factory method is not static; an instance of the factory needs to be created.

See Also:
  • Constructor Details

    • ContentItemFactory

      public ContentItemFactory()
  • Method Details

    • makeContainerContentItem

      public ContentItemFactory.ContainerContentItem makeContainerContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, boolean continuityOfContentIsSeparate, String templateMappingResource, String templateIdentifier, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      continuityOfContentIsSeparate - true if SEPARATE, false if CONTINUOUS
      templateMappingResource - identifier of the template mapping resource
      templateIdentifier - identifier of the template
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeContainerContentItem

      public ContentItemFactory.ContainerContentItem makeContainerContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, boolean continuityOfContentIsSeparate, String templateMappingResource, String templateIdentifier) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      continuityOfContentIsSeparate - true if SEPARATE, false if CONTINUOUS
      templateMappingResource - identifier of the template mapping resource
      templateIdentifier - identifier of the template
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeContainerContentItem

      public ContentItemFactory.ContainerContentItem makeContainerContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, boolean continuityOfContentIsSeparate) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      continuityOfContentIsSeparate - true if SEPARATE, false if CONTINUOUS
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeContainerContentItem

      public ContentItemFactory.ContainerContentItem makeContainerContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName) throws DicomException
      Construct a ContainerContentItem Default to separate continuity
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeCompositeContentItem

      public ContentItemFactory.CompositeContentItem makeCompositeContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String referencedSOPClassUID, String referencedSOPInstanceUID, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      referencedSOPClassUID - the SOP Class UID
      referencedSOPInstanceUID - the SOP Instance UID
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeCompositeContentItem

      public ContentItemFactory.CompositeContentItem makeCompositeContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String referencedSOPClassUID, String referencedSOPInstanceUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      referencedSOPClassUID - the SOP Class UID
      referencedSOPInstanceUID - the SOP Instance UID
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeImageContentItem

      public ContentItemFactory.ImageContentItem makeImageContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String referencedSOPClassUID, String referencedSOPInstanceUID, int referencedFrameNumber, int referencedSegmentNumber, String presentationStateSOPClassUID, String presentationStateSOPInstanceUID, String realWorldValueMappingSOPClassUID, String realWorldValueMappingSOPInstanceUID, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      referencedSOPClassUID - the SOP Class UID
      referencedSOPInstanceUID - the SOP Instance UID
      referencedFrameNumber - if < 1, not added
      referencedSegmentNumber - if < 1, not added
      presentationStateSOPClassUID - the SOP Class UID of the presentation state (or null or empty if none)
      presentationStateSOPInstanceUID - the SOP Instance UID of the presentation state (or null or empty if none)
      realWorldValueMappingSOPClassUID - the SOP Class UID of the RWV Map (or null or empty if none)
      realWorldValueMappingSOPInstanceUID - the SOP Instance UID of the RWV Map (or null or empty if none)
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeImageContentItem

      public ContentItemFactory.ImageContentItem makeImageContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String referencedSOPClassUID, String referencedSOPInstanceUID, int referencedFrameNumber, int referencedSegmentNumber, String presentationStateSOPClassUID, String presentationStateSOPInstanceUID, String realWorldValueMappingSOPClassUID, String realWorldValueMappingSOPInstanceUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      referencedSOPClassUID - the SOP Class UID
      referencedSOPInstanceUID - the SOP Instance UID
      referencedFrameNumber - if < 1, not added
      referencedSegmentNumber - if < 1, not added
      presentationStateSOPClassUID - the SOP Class UID of the presentation state (or null or empty if none)
      presentationStateSOPInstanceUID - the SOP Instance UID of the presentation state (or null or empty if none)
      realWorldValueMappingSOPClassUID - the SOP Class UID of the RWV Map (or null or empty if none)
      realWorldValueMappingSOPInstanceUID - the SOP Instance UID of the RWV Map (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeSpatialCoordinatesContentItem

      public ContentItemFactory.SpatialCoordinatesContentItem makeSpatialCoordinatesContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String graphicType, float[] graphicData, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      graphicType - graphic type
      graphicData - graphic data
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeSpatialCoordinatesContentItem

      public ContentItemFactory.SpatialCoordinatesContentItem makeSpatialCoordinatesContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String graphicType, float[] graphicData) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      graphicType - graphic type
      graphicData - graphic data
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeSpatialCoordinates3DContentItem

      public ContentItemFactory.SpatialCoordinates3DContentItem makeSpatialCoordinates3DContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String graphicType, float[] graphicData, String referencedFrameOfReferenceUID, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      graphicType - graphic type
      graphicData - graphic data
      referencedFrameOfReferenceUID - frame of reference UID
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeSpatialCoordinates3DContentItem

      public ContentItemFactory.SpatialCoordinates3DContentItem makeSpatialCoordinates3DContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String graphicType, float[] graphicData, String referencedFrameOfReferenceUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      graphicType - graphic type
      graphicData - graphic data
      referencedFrameOfReferenceUID - frame of reference UID
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeNumericContentItem

      public ContentItemFactory.NumericContentItem makeNumericContentItem(ContentItem parent, boolean isNotSR, String relationshipType, CodedSequenceItem conceptName, String numericValue, CodedSequenceItem units, CodedSequenceItem qualifier) throws DicomException
      Parameters:
      parent - parent content item to add to
      isNotSR - affects whether value type is NUM (false) or NUMERIC (true)
      relationshipType - relationship type
      conceptName - coded concept name
      numericValue - numeric value as decimal string
      units - code for the units
      qualifier - code for qualifier
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeNumericContentItem

      public ContentItemFactory.NumericContentItem makeNumericContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String numericValue, CodedSequenceItem units, CodedSequenceItem qualifier) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      numericValue - numeric value as decimal string
      units - code for the units
      qualifier - code for qualifier
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeNumericContentItem

      public ContentItemFactory.NumericContentItem makeNumericContentItem(ContentItem parent, boolean isNotSR, String relationshipType, CodedSequenceItem conceptName, double numericValue, CodedSequenceItem units) throws DicomException
      Parameters:
      parent - parent content item to add to
      isNotSR - affects whether value type is NUM (false) or NUMERIC (true)
      relationshipType - relationship type
      conceptName - coded concept name
      numericValue - numeric value as decimal string
      units - code for the units
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeNumericContentItem

      public ContentItemFactory.NumericContentItem makeNumericContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, double numericValue, CodedSequenceItem units) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      numericValue - numeric value as decimal string
      units - code for the units
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeNumericContentItem

      public ContentItemFactory.NumericContentItem makeNumericContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String numericValue, CodedSequenceItem units) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      numericValue - numeric value as decimal string
      units - code for the units
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeNumericContentItem

      public ContentItemFactory.NumericContentItem makeNumericContentItem(ContentItem parent, boolean isNotSR, String relationshipType, CodedSequenceItem conceptName, int numerator, long denominator, CodedSequenceItem units) throws DicomException
      Parameters:
      parent - parent content item to add to
      isNotSR - affects whether value type is NUM (false) or NUMERIC (true)
      relationshipType - relationship type
      conceptName - coded concept name
      numerator - integer numerator
      denominator - integer denominator
      units - code for the units
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeNumericContentItem

      public ContentItemFactory.NumericContentItem makeNumericContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, int numerator, long denominator, CodedSequenceItem units) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      numerator - integer numerator
      denominator - integer denominator
      units - code for the units
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeNumericContentItem

      public ContentItemFactory.NumericContentItem makeNumericContentItem(ContentItem parent, boolean isNotSR, String relationshipType, CodedSequenceItem conceptName, String numericValue, Double floatingPointValue, Integer rationalNumeratorValue, Long rationalDenominatorValue, CodedSequenceItem units, CodedSequenceItem qualifier) throws DicomException
      Parameters:
      parent - parent content item to add to
      isNotSR - affects whether value type is NUM (false) or NUMERIC (true)
      relationshipType - relationship type
      conceptName - coded concept name
      numericValue - numeric value as decimal string
      floatingPointValue - numeric value as floating point
      rationalNumeratorValue - integer numerator
      rationalDenominatorValue - integer denominator
      units - code for the units
      qualifier - code for qualifier
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeNumericContentItem

      public ContentItemFactory.NumericContentItem makeNumericContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String numericValue, Double floatingPointValue, Integer rationalNumeratorValue, Long rationalDenominatorValue, CodedSequenceItem units, CodedSequenceItem qualifier, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      numericValue - numeric value as decimal string
      floatingPointValue - numeric value as floating point
      rationalNumeratorValue - integer numerator
      rationalDenominatorValue - integer denominator
      units - code for the units
      qualifier - code for qualifier
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeNumericContentItem

      public ContentItemFactory.NumericContentItem makeNumericContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String numericValue, Double floatingPointValue, Integer rationalNumeratorValue, Long rationalDenominatorValue, CodedSequenceItem units, CodedSequenceItem qualifier) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      numericValue - numeric value as decimal string
      floatingPointValue - numeric value as floating point
      rationalNumeratorValue - integer numerator
      rationalDenominatorValue - integer denominator
      units - code for the units
      qualifier - code for qualifier
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeCodeContentItem

      public ContentItemFactory.CodeContentItem makeCodeContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, CodedSequenceItem conceptCode, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      conceptCode - coded value
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeCodeContentItem

      public ContentItemFactory.CodeContentItem makeCodeContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, CodedSequenceItem conceptCode) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      conceptCode - coded value
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • codeContentItemValueMatchesCodeValueAndCodingSchemeDesignator

      public static boolean codeContentItemValueMatchesCodeValueAndCodingSchemeDesignator(ContentItem ci, String cvWanted, String csdWanted)
      Test if the coded value of the code content item matches the specified code value and coding scheme designator. This is more robust than checking code meaning, which may have synomyms, and there is no need to also test code meaning.
      Parameters:
      ci - the content item to check
      cvWanted - the code value of the coded value wanted
      csdWanted - the coding scheme designator of the coded value wanted
      Returns:
      true if matches
    • makeDateTimeContentItem

      public ContentItemFactory.DateTimeContentItem makeDateTimeContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String dateTimeValue, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      dateTimeValue - datetime value
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeDateTimeContentItem

      public ContentItemFactory.DateTimeContentItem makeDateTimeContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String dateTimeValue) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      dateTimeValue - datetime value
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeDateContentItem

      public ContentItemFactory.DateContentItem makeDateContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String dateValue, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      dateValue - date value
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeDateContentItem

      public ContentItemFactory.DateContentItem makeDateContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String dateValue) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      dateValue - date value
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeTimeContentItem

      public ContentItemFactory.TimeContentItem makeTimeContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String timeValue, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      timeValue - time value
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeTimeContentItem

      public ContentItemFactory.TimeContentItem makeTimeContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String timeValue) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      timeValue - time value
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makePersonNameContentItem

      public ContentItemFactory.PersonNameContentItem makePersonNameContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String personNameValue, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      personNameValue - person name value
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makePersonNameContentItem

      public ContentItemFactory.PersonNameContentItem makePersonNameContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String personNameValue) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      personNameValue - person name value
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeUIDContentItem

      public ContentItemFactory.UIDContentItem makeUIDContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String uidValue, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      uidValue - UID value
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeUIDContentItem

      public ContentItemFactory.UIDContentItem makeUIDContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String uidValue) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      uidValue - UID value
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeTextContentItem

      public ContentItemFactory.TextContentItem makeTextContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String textValue, String observationDateTime, String observationUID) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      textValue - text value
      observationDateTime - Observation DateTime (or null or empty if none)
      observationUID - Observation UID (or null or empty if none)
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • makeTextContentItem

      public ContentItemFactory.TextContentItem makeTextContentItem(ContentItem parent, String relationshipType, CodedSequenceItem conceptName, String textValue) throws DicomException
      Parameters:
      parent - parent content item to add to
      relationshipType - relationship type
      conceptName - coded concept name
      textValue - text value
      Returns:
      the content item created
      Throws:
      DicomException - if error in DICOM encoding
    • getNewContentItem

      public ContentItem getNewContentItem(ContentItem parent, AttributeList list) throws DicomException

      Construct a content item of the appropriate class from a list of attributes.

      Parameters:
      parent - the parent to add the content item to
      list - a list of attributes that constitute the content item as it is encoded in a DICOM data set
      Returns:
      a content item
      Throws:
      DicomException - if error in DICOM encoding