File: gdcmModalityPerformedProcedureStepCreateQuery.cxx

package info (click to toggle)
gdcm 2.8.8-9
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 25,300 kB
  • sloc: cpp: 189,550; ansic: 70,447; xml: 46,290; python: 3,412; cs: 2,202; java: 1,468; lex: 1,290; sh: 253; php: 128; makefile: 105
file content (149 lines) | stat: -rw-r--r-- 6,302 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*=========================================================================

Program: GDCM (Grassroots DICOM). A DICOM library

Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.

This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#include "gdcmModalityPerformedProcedureStepCreateQuery.h"
#include "gdcmAttribute.h"
#include "gdcmSequenceOfItems.h"
#include <algorithm>

namespace gdcm
{

  ModalityPerformedProcedureStepCreateQuery::ModalityPerformedProcedureStepCreateQuery( const std::string & iSopInstanceUID )
  {
    mSopInstanceUID = iSopInstanceUID ;
  }

  bool ModalityPerformedProcedureStepCreateQuery::ValidateQuery(bool inStrict ) const
  {
    //if it's empty, it's not useful
    const DataSet &ds = GetQueryDataSet();
    if (ds.Size() == 0)
    {
      if (inStrict)
        gdcmWarningMacro( "Empty DataSet in ValidateQuery" );
      return false;
    }
	gdcm::DataSet requiredDataSet = GetRequiredDataSet();
	bool theReturn = ValidDataSet( ds, requiredDataSet ) ;
    return theReturn;
  }

  UIDs::TSName ModalityPerformedProcedureStepCreateQuery::GetAbstractSyntaxUID() const
  {
    return UIDs::ModalityPerformedProcedureStepSOPClass;
  }

  gdcm::DataSet 
  ModalityPerformedProcedureStepCreateQuery::GetRequiredDataSet() const
  {
		gdcm::DataSet validDataSet ;
		gdcm::DataElement ScheduledStepAttributeSequence( Tag(0x0040,0x0270), 0xFFFFFFFF, VR::SQ );
		gdcm::SmartPointer<gdcm::SequenceOfItems> sqItemList = new gdcm::SequenceOfItems();
		ScheduledStepAttributeSequence.SetValue( *sqItemList );
		validDataSet.Insert( ScheduledStepAttributeSequence );
		gdcm::Item & ScheduledStepAttributeSequenceItem = sqItemList->AddNewUndefinedLengthItem();

		gdcm::Attribute<0x0020,0x000D> StudyInstanceUID;
		ScheduledStepAttributeSequenceItem.GetNestedDataSet().Insert( StudyInstanceUID.GetAsDataElement() );

		sqItemList = new gdcm::SequenceOfItems();
		gdcm::DataElement ReferencedStudySequence( Tag(0x0008,0x1110), 0xFFFFFFFF, VR::SQ );
		ReferencedStudySequence.SetValue( *sqItemList );
		ScheduledStepAttributeSequenceItem.GetNestedDataSet().Insert( ReferencedStudySequence );
		
		gdcm::Attribute<0x0008,0x0050> AccessionNumber;
		ScheduledStepAttributeSequenceItem.GetNestedDataSet().Insert( AccessionNumber.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x1001> RequestedProcedureID;
		ScheduledStepAttributeSequenceItem.GetNestedDataSet().Insert( RequestedProcedureID.GetAsDataElement() );
		
		gdcm::Attribute<0x0032,0x1060> RequestedProcedureDescription;
		ScheduledStepAttributeSequenceItem.GetNestedDataSet().Insert( RequestedProcedureDescription.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x0009> ScheduledProcedureStepID;
		ScheduledStepAttributeSequenceItem.GetNestedDataSet().Insert( ScheduledProcedureStepID.GetAsDataElement() );
		gdcm::Attribute<0x0040,0x0007> ScheduledProcedureStepDescription;
		ScheduledStepAttributeSequenceItem.GetNestedDataSet().Insert( ScheduledProcedureStepDescription.GetAsDataElement() );

		sqItemList = new gdcm::SequenceOfItems();
		gdcm::DataElement ScheduledProtocolCodeSequence( Tag(0x0040,0x0008), 0xFFFFFFFF, VR::SQ );
		ScheduledProtocolCodeSequence.SetValue( *sqItemList );
		ScheduledStepAttributeSequenceItem.GetNestedDataSet().Insert( ScheduledProtocolCodeSequence );

		gdcm::Attribute<0x0010,0x0010> PatientsName;
		validDataSet.Insert( PatientsName.GetAsDataElement() );

		gdcm::Attribute<0x0010,0x0020> PatientID ;
		validDataSet.Insert( PatientID.GetAsDataElement() );

		gdcm::Attribute<0x0010,0x0030> PatientsBirthDate ;
		validDataSet.Insert( PatientsBirthDate.GetAsDataElement() );

		gdcm::Attribute<0x0010,0x0040> PatientsSex ;
		validDataSet.Insert( PatientsSex.GetAsDataElement() );

		gdcm::DataElement ReferencedPatientSequence( Tag(0x0008,0x1120), 0xFFFFFFFF, VR::SQ );
		validDataSet.Insert( ReferencedPatientSequence );

		gdcm::Attribute<0x0040,0x0253> PerformedProcedureStepID ;
		validDataSet.Insert( PerformedProcedureStepID.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x0241> PerformedStationAETitle ;
		validDataSet.Insert( PerformedStationAETitle.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x0242> PerformedStationName ;
		validDataSet.Insert( PerformedStationName.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x0243> PerformedLocation ;
		validDataSet.Insert( PerformedLocation.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x0244> PerformedProcedureStepStartDate ;
		validDataSet.Insert( PerformedProcedureStepStartDate.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x0245> PerformedProcedureStepStartTime ;
		validDataSet.Insert( PerformedProcedureStepStartTime.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x0252> PerformedProcedureStepStatus ;
		validDataSet.Insert( PerformedProcedureStepStatus.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x0254> PerformedProcedureStepDescription ;
		validDataSet.Insert( PerformedProcedureStepDescription.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x0255> PerformedProcedureTypeDescription ;
		validDataSet.Insert( PerformedProcedureTypeDescription.GetAsDataElement() );

		gdcm::DataElement ProcedureCodeSequence( Tag(0x0008,0x1032), 0xFFFFFFFF, VR::SQ );
		validDataSet.Insert( ProcedureCodeSequence );

		gdcm::Attribute<0x0040,0x0250> PerformedProcedureStepEndDate ;
		validDataSet.Insert( PerformedProcedureStepEndDate.GetAsDataElement() );

		gdcm::Attribute<0x0040,0x0251> PerformedProcedureStepEndTime ;
		validDataSet.Insert( PerformedProcedureStepEndTime.GetAsDataElement() );

		gdcm::Attribute<0x0008,0x0060> Modality ;
		validDataSet.Insert( Modality.GetAsDataElement() );

		gdcm::Attribute<0x0020,0x0010> StudyID ;
		validDataSet.Insert( StudyID.GetAsDataElement() );

		gdcm::DataElement PerformedProtocolCodeSequence( Tag(0x0040,0x0260), 0xFFFFFFFF, VR::SQ );
		validDataSet.Insert( PerformedProtocolCodeSequence );

		gdcm::DataElement PerformedSeriesSequence( Tag(0x0040,0x0340), 0xFFFFFFFF, VR::SQ );
		validDataSet.Insert( PerformedSeriesSequence );

		return validDataSet ;
  }      
}