Package com.pixelmed.query

# Class StudyRootQueryInformationModel

java.lang.Object
com.pixelmed.query.QueryInformationModel
com.pixelmed.query.StudyRootQueryInformationModel

public class StudyRootQueryInformationModel extends QueryInformationModel

The `StudyRootQueryInformationModel` supports query and retrieval using the DICOM Study Root information model.

Specifically, all patient attributes are included at the level of the study, and below the study level are series and instance (image) levels.

For example, an application might instantiate a `StudyRootQueryInformationModel`, and then actually perform a query (with debugging messages on) using a list of attributes as follows:

            final QueryInformationModel model = new StudyRootQueryInformationModel("remotehost",104,"THEIRAET","OURAET",1);
            final QueryTreeModel tree = model.performHierarchicalQuery(identifier);
            System.err.println("Tree="+tree);

The attribute list supplied must contain both matching and response keys. By way of example, one could construct an identifier for a query of all the instances for a particular patient named "Smith^Mary" as follows

            AttributeList identifier = new AttributeList();
            { AttributeTag t = TagFromName.PatientName; Attribute a = new PersonNameAttribute(t,specificCharacterSet); a.addValue("Smith^Mary"); filter.put(t,a); }
            { AttributeTag t = TagFromName.PatientID; Attribute a = new ShortStringAttribute(t,specificCharacterSet); filter.put(t,a); }
            { AttributeTag t = TagFromName.PatientBirthDate; Attribute a = new DateAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.PatientSex; Attribute a = new CodeStringAttribute(t); filter.put(t,a); }

            { AttributeTag t = TagFromName.StudyID; Attribute a = new ShortStringAttribute(t,specificCharacterSet); filter.put(t,a); }
            { AttributeTag t = TagFromName.StudyDescription; Attribute a = new LongStringAttribute(t,specificCharacterSet); filter.put(t,a); }
            { AttributeTag t = TagFromName.ModalitiesInStudy; Attribute a = new CodeStringAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.StudyDate; Attribute a = new DateAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.StudyTime; Attribute a = new TimeAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.PatientAge; Attribute a = new AgeStringAttribute(t); filter.put(t,a); }

            { AttributeTag t = TagFromName.SeriesDescription; Attribute a = new LongStringAttribute(t,specificCharacterSet); filter.put(t,a); }
            { AttributeTag t = TagFromName.SeriesNumber; Attribute a = new IntegerStringAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.Modality; Attribute a = new CodeStringAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.SeriesDate; Attribute a = new DateAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.SeriesTime; Attribute a = new TimeAttribute(t); filter.put(t,a); }

            { AttributeTag t = TagFromName.InstanceNumber; Attribute a = new IntegerStringAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.ContentDate; Attribute a = new DateAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.ContentTime; Attribute a = new TimeAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.ImageType; Attribute a = new CodeStringAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.NumberOfFrames; Attribute a = new IntegerStringAttribute(t); filter.put(t,a); }

            { AttributeTag t = TagFromName.StudyInstanceUID; Attribute a = new UniqueIdentifierAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.SeriesInstanceUID; Attribute a = new UniqueIdentifierAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.SOPInstanceUID; Attribute a = new UniqueIdentifierAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.SOPClassUID; Attribute a = new UniqueIdentifierAttribute(t); filter.put(t,a); }
            { AttributeTag t = TagFromName.SpecificCharacterSet; Attribute a = new CodeStringAttribute(t); filter.put(t,a); a.addValue("ISO_IR 100"); }

The resulting tree will contain all the returned information at the study, series and instance (image) returned which match a PatientName of "Smith^Mary". If one wanted to filer the list of studies and series returned by a Modality of CT, then one could instead have created an identifier containing:

            { AttributeTag t = TagFromName.ModalitiesInStudy; Attribute a = new CodeStringAttribute(t); a.addValue("CT"); filter.put(t,a); }
            { AttributeTag t = TagFromName.Modality; Attribute a = new CodeStringAttribute(t); a.addValue("CT"); filter.put(t,a); }

Note that since ModalitiesInStudy is an optional matching key in DICOM, not all SCPs will support it, so one should also filter at the series level with Modality. In those cases "empty" study responses will be included when the study matches but there are no modality-specific series.

Note also that no "client side" filtering is performed ... that is the values for matching keys will be sent to the SCP, but if the SCP doesn't match on them and returns responses anyway, this class does not filter out those responses before returning them to the user (including them in the returned tree).

In a real application, the `FilterPanel` class can be used to provide a user interface for editing the values in the request identifier attribute list.

See Also:
  - `QueryInformationModel`
  - `QueryTreeModel`
  - `FilterPanel`
  - `AttributeList`
  - `Attribute`
  - `AttributeTag`
  - `TagFromName`

## Field Summary

### Fields inherited from class com.pixelmed.query.QueryInformationModel

`cFindAssociation, cMoveAssociation`

## Constructor Summary

Constructors
Constructor
Description
`StudyRootQueryInformationModel(String hostname, int port, String calledAETitle, String callingAETitle)`
Construct a study root query information model.
`StudyRootQueryInformationModel(String hostname, int port, String calledAETitle, String callingAETitle, boolean reuseAssociations)`
Construct a study root query information model.
`StudyRootQueryInformationModel(String hostname, int port, String calledAETitle, String callingAETitle, int debugLevel)`
Construct a study root query information model.
`StudyRootQueryInformationModel(String hostname, int port, String calledAETitle, String callingAETitle, int debugLevel, boolean reuseAssociations)`
Construct a study root query information model.

## Method Summary

Modifier and Type
Method
Description
`protected HashSet`
`getAllInformationEntitiesToIncludeAtThisQueryLevel(InformationEntity ie)`
`protected InformationEntity`
`getChildTypeForParent(InformationEntity ie)`
`protected String`
`getFindSOPClassUID()`
`protected String`
`getMoveSOPClassUID()`
`protected InformationEntity`
`getRoot()`
`protected String`
`getStringValueForTreeFromResponseIdentifier(InformationEntity ie, AttributeList responseIdentifier)`
`static void`
`main(String[] arg)`
Unit testing.

### Methods inherited from class com.pixelmed.query.QueryInformationModel

`getAttributeTagOfCountOfChildren, getCalledAETitle, getCFindAssociation, getCMoveAssociation, getQueryLevelName, getUniqueKeyForInformationEntity, performHierarchicalMove, performHierarchicalMove, performHierarchicalMoveFrom, performHierarchicalMoveFromTo, performHierarchicalMoveTo, performHierarchicalQuery, releaseAssociations, toString`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### StudyRootQueryInformationModel

public StudyRootQueryInformationModel(String hostname, int port, String calledAETitle, String callingAETitle, int debugLevel, boolean reuseAssociations) throws DicomNetworkException, DicomException, IOException

Construct a study root query information model.

Parameters:
  `hostname` - their hostname or IP address
  `port` - their port number
  `calledAETitle` - their AE title
  `callingAETitle` - our AE title (both when we query or retrieve and where we are listening as a storage SCP)
  `debugLevel` - ignored
  `reuseAssociations` - keep alive and reuse Associations
Throws:
  `DicomException`
  `DicomNetworkException`
  `IOException`

### StudyRootQueryInformationModel

public StudyRootQueryInformationModel(String hostname, int port, String calledAETitle, String callingAETitle, boolean reuseAssociations) throws DicomNetworkException, DicomException, IOException

Construct a study root query information model.

Parameters:
  `hostname` - their hostname or IP address
  `port` - their port number
  `calledAETitle` - their AE title
  `callingAETitle` - our AE title (both when we query or retrieve and where we are listening as a storage SCP)
  `reuseAssociations` - keep alive and reuse Associations
Throws:
  `DicomException`
  `DicomNetworkException`
  `IOException`

### StudyRootQueryInformationModel

public StudyRootQueryInformationModel(String hostname, int port, String calledAETitle, String callingAETitle, int debugLevel)

Construct a study root query information model.

Parameters:
  `hostname` - their hostname or IP address
  `port` - their port number
  `calledAETitle` - their AE title
  `callingAETitle` - our AE title (both when we query or retrieve and where we are listening as a storage SCP)
  `debugLevel` - ignored

### StudyRootQueryInformationModel

public StudyRootQueryInformationModel(String hostname, int port, String calledAETitle, String callingAETitle)

Construct a study root query information model.

Parameters:
  `hostname` - their hostname or IP address
  `port` - their port number
  `calledAETitle` - their AE title
  `callingAETitle` - our AE title (both when we query or retrieve and where we are listening as a storage SCP)

## Method Details

### getRoot

protected InformationEntity getRoot()

Specified by:
  `getRoot` in class `QueryInformationModel`

### getChildTypeForParent

protected InformationEntity getChildTypeForParent(InformationEntity ie)

Specified by:
  `getChildTypeForParent` in class `QueryInformationModel`
Parameters:
  `ie` -

### getAllInformationEntitiesToIncludeAtThisQueryLevel

protected HashSet getAllInformationEntitiesToIncludeAtThisQueryLevel(InformationEntity ie)

Specified by:
  `getAllInformationEntitiesToIncludeAtThisQueryLevel` in class `QueryInformationModel`
Parameters:
  `ie` -

### getFindSOPClassUID

protected String getFindSOPClassUID()

Specified by:
  `getFindSOPClassUID` in class `QueryInformationModel`

### getMoveSOPClassUID

protected String getMoveSOPClassUID()

Specified by:
  `getMoveSOPClassUID` in class `QueryInformationModel`

### getStringValueForTreeFromResponseIdentifier

protected String getStringValueForTreeFromResponseIdentifier(InformationEntity ie, AttributeList responseIdentifier)

Specified by:
  `getStringValueForTreeFromResponseIdentifier` in class `QueryInformationModel`
Parameters:
  `ie` -
  `responseIdentifier` -

### main

public static void main(String[] arg)

Unit testing.

Parameters:
  `arg` - an array of four strings, hostname, port, calledAETitle, callingAETitle