1 /*
2  *
3  *  Copyright (C) 1998-2019, OFFIS e.V.
4  *  All rights reserved.  See COPYRIGHT file for details.
5  *
6  *  This software and supporting documentation were developed by
7  *
8  *    OFFIS e.V.
9  *    R&D Division Health
10  *    Escherweg 2
11  *    D-26121 Oldenburg, Germany
12  *
13  *
14  *  Module: dcmsign
15  *
16  *  Author: Norbert Loxen, Marco Eichelberg
17  *
18  *  Purpose:
19  *    classes: SiCreatorProfile
20  *
21  */
22 
23 #include "dcmtk/config/osconfig.h"
24 
25 #ifdef WITH_OPENSSL
26 
27 #include "dcmtk/dcmsign/sicreapr.h"
28 #include "dcmtk/dcmdata/dcdeftag.h"
29 #include "dcmtk/dcmdata/dcitem.h"
30 #include "dcmtk/dcmsign/sitypes.h"
31 
SiCreatorProfile()32 SiCreatorProfile::SiCreatorProfile()
33 : containsRawData_(OFFalse)
34 {
35 }
36 
attributeRequiredIfPresent(const DcmTagKey & key) const37 OFBool SiCreatorProfile::attributeRequiredIfPresent(const DcmTagKey& key) const
38 {
39   // This list of attribute tags was extracted from DICOM 2019c.
40   // Attribute tags occuring in multiple modules were commented out
41   // but remain in the source code to simplify a comparison with the
42   // module tables in a later edition of the DICOM standard.
43 
44   // The following attributes must be included in the signature if present
45   // according to the Creator RSA Digital Signature Profile
46   // (DICOM Part 15, section C.2):
47 
48   // the SOP Class and Instance UIDs
49   if (key == DCM_SOPClassUID) return OFTrue;
50   if (key == DCM_SOPInstanceUID) return OFTrue;
51 
52   // the SOP Creation Date and Time, if present
53   if (key == DCM_InstanceCreationDate) return OFTrue;
54   if (key == DCM_InstanceCreationTime) return OFTrue;
55 
56   // the Study and Series Instance UIDs
57   if (key == DCM_StudyInstanceUID) return OFTrue;
58   if (key == DCM_SeriesInstanceUID) return OFTrue;
59 
60   // any attributes of the General Equipment Module that are present
61   if (key == DCM_Manufacturer) return OFTrue;
62   if (key == DCM_InstitutionName) return OFTrue;
63   if (key == DCM_InstitutionAddress) return OFTrue;
64   if (key == DCM_StationName) return OFTrue;
65   if (key == DCM_InstitutionalDepartmentName) return OFTrue;
66   if (key == DCM_InstitutionalDepartmentTypeCodeSequence) return OFTrue;
67   if (key == DCM_ManufacturerModelName) return OFTrue;
68   if (key == DCM_DeviceSerialNumber) return OFTrue;
69   if (key == DCM_SoftwareVersions) return OFTrue;
70   if (key == DCM_GantryID) return OFTrue;
71   if (key == DCM_UDISequence) return OFTrue;
72   if (key == DCM_DeviceUID) return OFTrue;
73   if (key == DCM_SpatialResolution) return OFTrue;
74   if (key == DCM_DateOfLastCalibration) return OFTrue;
75   if (key == DCM_TimeOfLastCalibration) return OFTrue;
76   if (key == DCM_PixelPaddingValue) return OFTrue;
77 
78   // any attributes of the Overlay Plane Module that are present
79   if (key == DCM_OverlayRows) return OFTrue;
80   if (key == DCM_OverlayColumns) return OFTrue;
81   if (key == DCM_OverlayType) return OFTrue;
82   if (key == DCM_OverlayOrigin) return OFTrue;
83   if (key == DCM_OverlayBitsAllocated) return OFTrue;
84   if (key == DCM_OverlayBitPosition) return OFTrue;
85   if (key == DCM_OverlayData) return OFTrue;
86   if (key == DCM_OverlayDescription) return OFTrue;
87   if (key == DCM_OverlaySubtype) return OFTrue;
88   if (key == DCM_OverlayLabel) return OFTrue;
89   if (key == DCM_ROIArea) return OFTrue;
90   if (key == DCM_ROIMean) return OFTrue;
91   if (key == DCM_ROIStandardDeviation) return OFTrue;
92 
93   // any attributes of the Curve Module that are present
94   if ((key.getGroup() >= 0x5000) && (key.getGroup() < 0x5020) && ((key.getGroup() & 1) == 0))
95   {
96     switch (key.getElement())
97     {
98       case 0x0005: // CurveDimensions (retired)
99       case 0x0010: // NumberOfPoints (retired)
100       case 0x0103: // DataValueRepresentation (retired)
101       case 0x3000: // CurveData (retired)
102       case 0x0022: // CurveDescription (retired)
103       case 0x0030: // AxisUnits (retired)
104       case 0x0040: // AxisLabels (retired)
105       case 0x0104: // MinimumCoordinateValue (retired)
106       case 0x0105: // MaximumCoordinateValue (retired)
107       case 0x0106: // CurveRange (retired)
108       case 0x0110: // CurveDataDescriptor (retired)
109       case 0x0112: // CoordinateStartValue (retired)
110       case 0x0114: // CoordinateStepValue (retired)
111       case 0x2500: // CurveLabel (retired)
112       case 0x2600: // ReferencedOverlaySequence (retired)
113         return OFTrue;
114         break;
115       default:
116         /* nothing */
117         break;
118     }
119   }
120 
121   // any attributes of the Graphic Annotation Module that are present
122   if (key == DCM_GraphicAnnotationSequence) return OFTrue;
123 
124   // any attributes of the General Image Module that are present
125   if (key == DCM_InstanceNumber) return OFTrue;
126   if (key == DCM_PatientOrientation) return OFTrue;
127   if (key == DCM_ContentDate) return OFTrue;
128   if (key == DCM_ContentTime) return OFTrue;
129   if (key == DCM_ImageType) return OFTrue;
130   if (key == DCM_AcquisitionNumber) return OFTrue;
131   if (key == DCM_AcquisitionDate) return OFTrue;
132   if (key == DCM_AcquisitionTime) return OFTrue;
133   if (key == DCM_AcquisitionDateTime) return OFTrue;
134   if (key == DCM_ImagesInAcquisition) return OFTrue;
135   if (key == DCM_ImageComments) return OFTrue;
136   if (key == DCM_QualityControlImage) return OFTrue;
137   if (key == DCM_BurnedInAnnotation) return OFTrue;
138   if (key == DCM_RecognizableVisualFeatures) return OFTrue;
139   if (key == DCM_LossyImageCompression) return OFTrue;
140   if (key == DCM_LossyImageCompressionRatio) return OFTrue;
141   if (key == DCM_LossyImageCompressionMethod) return OFTrue;
142   if (key == DCM_IconImageSequence) return OFTrue;
143   if (key == DCM_PresentationLUTShape) return OFTrue;
144   if (key == DCM_IrradiationEventUID) return OFTrue;
145   if (key == DCM_RealWorldValueMappingSequence) return OFTrue;
146   if (key == DCM_ImageLaterality) return OFTrue;
147   if (key == DCM_AnatomicRegionSequence) return OFTrue;
148   if (key == DCM_PrimaryAnatomicStructureSequence) return OFTrue;
149 
150   // any attributes of the Image Pixel Module that are present
151   if (key == DCM_SamplesPerPixel) return OFTrue;
152   if (key == DCM_PhotometricInterpretation) return OFTrue;
153   if (key == DCM_Rows) return OFTrue;
154   if (key == DCM_Columns) return OFTrue;
155   if (key == DCM_BitsAllocated) return OFTrue;
156   if (key == DCM_BitsStored) return OFTrue;
157   if (key == DCM_HighBit) return OFTrue;
158   if (key == DCM_PixelRepresentation) return OFTrue;
159   if (key == DCM_PlanarConfiguration) return OFTrue;
160   if (key == DCM_PixelAspectRatio) return OFTrue;
161   if (key == DCM_SmallestImagePixelValue) return OFTrue;
162   if (key == DCM_LargestImagePixelValue) return OFTrue;
163   if (key == DCM_RedPaletteColorLookupTableDescriptor) return OFTrue;
164   if (key == DCM_GreenPaletteColorLookupTableDescriptor) return OFTrue;
165   if (key == DCM_BluePaletteColorLookupTableDescriptor) return OFTrue;
166   if (key == DCM_RedPaletteColorLookupTableData) return OFTrue;
167   if (key == DCM_GreenPaletteColorLookupTableData) return OFTrue;
168   if (key == DCM_BluePaletteColorLookupTableData) return OFTrue;
169   if (key == DCM_ICCProfile) return OFTrue;
170   if (key == DCM_ColorSpace) return OFTrue;
171   if (key == DCM_PixelData) return OFTrue;
172   if (key == DCM_PixelDataProviderURL) return OFTrue;
173   if (key == DCM_PixelPaddingRangeLimit) return OFTrue;
174   if (key == DCM_ExtendedOffsetTable) return OFTrue;
175   if (key == DCM_ExtendedOffsetTableLengths) return OFTrue;
176 
177   // any attributes of the SR Document General Module that are present
178   // if (key == DCM_InstanceNumber) return OFTrue; // also in General Image Module
179   if (key == DCM_PreliminaryFlag) return OFTrue;
180   if (key == DCM_CompletionFlag) return OFTrue;
181   if (key == DCM_CompletionFlagDescription) return OFTrue;
182   if (key == DCM_VerificationFlag) return OFTrue;
183   // if (key == DCM_ContentDate) return OFTrue; // also in General Image Module
184   // if (key == DCM_ContentTime) return OFTrue; // also in General Image Module
185   if (key == DCM_VerifyingObserverSequence) return OFTrue;
186   if (key == DCM_AuthorObserverSequence) return OFTrue;
187   if (key == DCM_ParticipantSequence) return OFTrue;
188   if (key == DCM_CustodialOrganizationSequence) return OFTrue;
189   if (key == DCM_PredecessorDocumentsSequence) return OFTrue;
190   if (key == DCM_IdenticalDocumentsSequence) return OFTrue;
191   if (key == DCM_ReferencedRequestSequence) return OFTrue;
192   if (key == DCM_PerformedProcedureCodeSequence) return OFTrue;
193   if (key == DCM_CurrentRequestedProcedureEvidenceSequence) return OFTrue;
194   if (key == DCM_PertinentOtherEvidenceSequence) return OFTrue;
195   if (key == DCM_ReferencedInstanceSequence) return OFTrue;
196 
197   // any attributes of the SR Document Content Module that are present
198   if (key == DCM_ValueType) return OFTrue;
199   if (key == DCM_ConceptNameCodeSequence) return OFTrue;
200   if (key == DCM_ContinuityOfContent) return OFTrue;
201   if (key == DCM_ContentTemplateSequence) return OFTrue;
202   if (key == DCM_ObservationDateTime) return OFTrue;
203   if (key == DCM_ObservationUID) return OFTrue;
204   if (key == DCM_ContentSequence) return OFTrue;
205 
206   // any attributes of the Waveform Module that are present
207   if (key == DCM_WaveformSequence) return OFTrue;
208   if (key == DCM_WaveformDataDisplayScale) return OFTrue;
209   if (key == DCM_WaveformDisplayBackgroundCIELabValue) return OFTrue;
210   if (key == DCM_WaveformPresentationGroupSequence) return OFTrue;
211 
212   // any attributes of the Waveform Annotation Module that are present
213   if (key == DCM_WaveformAnnotationSequence) return OFTrue;
214 
215   // any attributes of the Multi-frame Functional Groups Module that are present
216   if (key == DCM_SharedFunctionalGroupsSequence) return OFTrue;
217   if (key == DCM_PerFrameFunctionalGroupsSequence) return OFTrue;
218   // if (key == DCM_InstanceNumber) return OFTrue; // also in General Image Module
219   // if (key == DCM_ContentDate) return OFTrue; // also in General Image Module
220   // if (key == DCM_ContentTime) return OFTrue; // also in General Image Module
221   if (key == DCM_NumberOfFrames) return OFTrue;
222   if (key == DCM_StereoPairsPresent) return OFTrue;
223   if (key == DCM_ConcatenationFrameOffsetNumber) return OFTrue;
224   if (key == DCM_RepresentativeFrameNumber) return OFTrue;
225   if (key == DCM_ConcatenationUID) return OFTrue;
226   if (key == DCM_SOPInstanceUIDOfConcatenationSource) return OFTrue;
227   if (key == DCM_InConcatenationNumber) return OFTrue;
228   if (key == DCM_InConcatenationTotalNumber) return OFTrue;
229 
230   // any attributes of the Enhanced MR Image Module that are present
231   // if (key == DCM_AcquisitionNumber) return OFTrue; // also in General Image Module
232   // if (key == DCM_AcquisitionDateTime) return OFTrue; // also in General Image Module
233   if (key == DCM_AcquisitionDuration) return OFTrue;
234   if (key == DCM_ReferencedRawDataSequence) return OFTrue;
235   if (key == DCM_ReferencedWaveformSequence) return OFTrue;
236   if (key == DCM_ReferencedImageEvidenceSequence) return OFTrue;
237   if (key == DCM_SourceImageEvidenceSequence) return OFTrue;
238   if (key == DCM_ReferencedPresentationStateSequence) return OFTrue;
239   if (key == DCM_ContentQualification) return OFTrue;
240   if (key == DCM_ResonantNucleus) return OFTrue;
241   if (key == DCM_KSpaceFiltering) return OFTrue;
242   if (key == DCM_MagneticFieldStrength) return OFTrue;
243   if (key == DCM_ApplicableSafetyStandardAgency) return OFTrue;
244   if (key == DCM_ApplicableSafetyStandardDescription) return OFTrue;
245   // if (key == DCM_ImageComments) return OFTrue; // also in General Image Module
246   if (key == DCM_IsocenterPosition) return OFTrue;
247   if (key == DCM_B1rms) return OFTrue;
248   // if (key == DCM_ImageType) return OFTrue; // also in General Image Module
249   if (key == DCM_PixelPresentation) return OFTrue;
250   if (key == DCM_VolumetricProperties) return OFTrue;
251   if (key == DCM_VolumeBasedCalculationTechnique) return OFTrue;
252   if (key == DCM_ComplexImageComponent) return OFTrue;
253   if (key == DCM_AcquisitionContrast) return OFTrue;
254   if (key == DCM_FunctionalSettlingPhaseFramesPresent) return OFTrue;
255   // if (key == DCM_SamplesPerPixel) return OFTrue; // also in Image Pixel Module
256   // if (key == DCM_PhotometricInterpretation) return OFTrue; // also in Image Pixel Module
257   // if (key == DCM_BitsAllocated) return OFTrue; // also in Image Pixel Module
258   // if (key == DCM_BitsStored) return OFTrue; // also in Image Pixel Module
259   // if (key == DCM_HighBit) return OFTrue; // also in Image Pixel Module
260   // if (key == DCM_PixelRepresentation) return OFTrue; // also in Image Pixel Module
261   // if (key == DCM_PlanarConfiguration) return OFTrue; // also in Image Pixel Module
262   // if (key == DCM_BurnedInAnnotation) return OFTrue; // also in General Image Module
263   // if (key == DCM_RecognizableVisualFeatures) return OFTrue; // also in General Image Module
264   // if (key == DCM_LossyImageCompression) return OFTrue; // also in General Image Module
265   // if (key == DCM_LossyImageCompressionRatio) return OFTrue; // also in General Image Module
266   // if (key == DCM_LossyImageCompressionMethod) return OFTrue; // also in General Image Module
267   // if (key == DCM_PresentationLUTShape) return OFTrue; // also in General Image Module
268   // if (key == DCM_IconImageSequence) return OFTrue; // also in General Image Module
269   if (key == DCM_ViewCodeSequence) return OFTrue;
270   if (key == DCM_SliceProgressionDirection) return OFTrue;
271 
272   // any attributes of the MR Spectroscopy Module that are present
273   // if (key == DCM_AcquisitionNumber) return OFTrue;  // also in Enhanced MR Image Module
274   // if (key == DCM_AcquisitionDateTime) return OFTrue;  // also in Enhanced MR Image Module
275   // if (key == DCM_AcquisitionDuration) return OFTrue;  // also in Enhanced MR Image Module
276   // if (key == DCM_ReferencedRawDataSequence) return OFTrue;  // also in Enhanced MR Image Module
277   // if (key == DCM_ReferencedWaveformSequence) return OFTrue;  // also in Enhanced MR Image Module
278   // if (key == DCM_ReferencedImageEvidenceSequence) return OFTrue;  // also in Enhanced MR Image Module
279   // if (key == DCM_SourceImageEvidenceSequence) return OFTrue;  // also in Enhanced MR Image Module
280   // if (key == DCM_ReferencedPresentationStateSequence) return OFTrue;  // also in Enhanced MR Image Module
281   // if (key == DCM_ContentQualification) return OFTrue;  // also in Enhanced MR Image Module
282   // if (key == DCM_ResonantNucleus) return OFTrue;  // also in Enhanced MR Image Module
283   // if (key == DCM_k-SpaceFiltering) return OFTrue;  // also in Enhanced MR Image Module
284   // if (key == DCM_MagneticFieldStrength) return OFTrue;  // also in Enhanced MR Image Module
285   // if (key == DCM_ApplicableSafetyStandardAgency) return OFTrue;  // also in Enhanced MR Image Module
286   // if (key == DCM_ApplicableSafetyStandardDescription) return OFTrue;  // also in Enhanced MR Image Module
287   // if (key == DCM_ImageComments) return OFTrue;  // also in Enhanced MR Image Module
288   // if (key == DCM_IsocenterPosition) return OFTrue;  // also in Enhanced MR Image Module
289   // if (key == DCM_B1rms) return OFTrue;  // also in Enhanced MR Image Module
290   // if (key == DCM_ImageType) return OFTrue;  // also in Enhanced MR Image Module
291   // if (key == DCM_VolumetricProperties) return OFTrue; // also in Enhanced MR Image Module
292   // if (key == DCM_VolumeBasedCalculationTechnique) return OFTrue; // also in Enhanced MR Image Module
293   // if (key == DCM_ComplexImageComponent) return OFTrue; // also in Enhanced MR Image Module
294   // if (key == DCM_AcquisitionContrast) return OFTrue; // also in Enhanced MR Image Module
295   if (key == DCM_TransmitterFrequency) return OFTrue;
296   if (key == DCM_SpectralWidth) return OFTrue;
297   if (key == DCM_ChemicalShiftReference) return OFTrue;
298   if (key == DCM_VolumeLocalizationTechnique) return OFTrue;
299   if (key == DCM_VolumeLocalizationSequence) return OFTrue;
300   if (key == DCM_Decoupling) return OFTrue;
301   if (key == DCM_DecoupledNucleus) return OFTrue;
302   if (key == DCM_DecouplingFrequency) return OFTrue;
303   if (key == DCM_DecouplingMethod) return OFTrue;
304   if (key == DCM_DecouplingChemicalShiftReference) return OFTrue;
305   if (key == DCM_TimeDomainFiltering) return OFTrue;
306   if (key == DCM_NumberOfZeroFills) return OFTrue;
307   if (key == DCM_BaselineCorrection) return OFTrue;
308   if (key == DCM_FrequencyCorrection) return OFTrue;
309   if (key == DCM_FirstOrderPhaseCorrection) return OFTrue;
310   if (key == DCM_WaterReferencedPhaseCorrection) return OFTrue;
311   if (key == DCM_WaterReferenceAcquisition) return OFTrue;
312   // if (key == DCM_ReferencedInstanceSequence) return OFTrue; // also in SR Document General Module
313 
314   // any attributes of the Raw Data Module that are present
315   // if (key == DCM_InstanceNumber) return OFTrue; // also in General Image Module
316   // if (key == DCM_ContentDate) return OFTrue; // also in General Image Module
317   // if (key == DCM_ContentTime) return OFTrue; // also in General Image Module
318   // if (key == DCM_AcquisitionDateTime) return OFTrue; // also in General Image Module
319   if (key == DCM_ContentLabel) return OFTrue;
320   if (key == DCM_ContentDescription) return OFTrue;
321   // if (key == DCM_ConceptNameCodeSequence) return OFTrue; // also in SR Document Content Module
322   // if (key == DCM_ImageLaterality) return OFTrue; // also in General Image Module
323   if (key == DCM_CreatorVersionUID) return OFTrue;
324   // if (key == DCM_ReferencedInstanceSequence) return OFTrue; // also in SR Document General Module
325 
326   // if the Raw Data Module is present, we need to include all private tags into
327   // signature because the raw data as such is stored in private attributes.
328   if (((key.getGroup() & 1) == 1) && containsRawData_) return OFTrue;
329 
330   // any attributes of the Enhanced CT Image Module that are present
331   // if (key == DCM_ImageType) return OFTrue; // also in General Image Module
332   if (key == DCM_MultienergyCTAcquisition) return OFTrue;
333   // if (key == DCM_AcquisitionNumber) return OFTrue; // also in General Image Module
334   // if (key == DCM_AcquisitionDateTime) return OFTrue; // also in General Image Module
335   // if (key == DCM_AcquisitionDuration) return OFTrue;  // also in Enhanced MR Image Module
336   // if (key == DCM_ReferencedRawDataSequence) return OFTrue;  // also in Enhanced MR Image Module
337   // if (key == DCM_ReferencedWaveformSequence) return OFTrue;  // also in Enhanced MR Image Module
338   // if (key == DCM_ReferencedImageEvidenceSequence) return OFTrue;  // also in Enhanced MR Image Module
339   // if (key == DCM_SourceImageEvidenceSequence) return OFTrue;  // also in Enhanced MR Image Module
340   // if (key == DCM_ReferencedPresentationStateSequence) return OFTrue;  // also in Enhanced MR Image Module
341   // if (key == DCM_SamplesPerPixel) return OFTrue; // also in Image Pixel Module
342   // if (key == DCM_PhotometricInterpretation) return OFTrue; // also in Image Pixel Module
343   // if (key == DCM_BitsAllocated) return OFTrue; // also in Image Pixel Module
344   // if (key == DCM_BitsStored) return OFTrue; // also in Image Pixel Module
345   // if (key == DCM_HighBit) return OFTrue; // also in Image Pixel Module
346   // if (key == DCM_ContentQualification) return OFTrue;  // also in Enhanced MR Image Module
347   // if (key == DCM_ImageComments) return OFTrue; // also in General Image Module
348   // if (key == DCM_BurnedInAnnotation) return OFTrue; // also in General Image Module
349   // if (key == DCM_RecognizableVisualFeatures) return OFTrue; // also in General Image Module
350   // if (key == DCM_LossyImageCompression) return OFTrue; // also in General Image Module
351   // if (key == DCM_LossyImageCompressionRatio) return OFTrue; // also in General Image Module
352   // if (key == DCM_LossyImageCompressionMethod) return OFTrue; // also in General Image Module
353   // if (key == DCM_PresentationLUTShape) return OFTrue; // also in General Image Module
354   // if (key == DCM_IconImageSequence) return OFTrue; // also in General Image Module
355   // if (key == DCM_IsocenterPosition) return OFTrue;  // also in Enhanced MR Image Module
356 
357   // any attributes of the Enhanced XA/XRF Image Module that are present
358   // if (key == DCM_ImageType) return OFTrue; // also in General Image Module
359   if (key == DCM_PlanesInAcquisition) return OFTrue;
360   if (key == DCM_PlaneIdentification) return OFTrue;
361   // if (key == DCM_AcquisitionNumber) return OFTrue; // also in General Image Module
362   // if (key == DCM_AcquisitionDateTime) return OFTrue; // also in General Image Module
363   // if (key == DCM_BitsAllocated) return OFTrue; // also in Image Pixel Module
364   // if (key == DCM_BitsStored) return OFTrue; // also in Image Pixel Module
365   // if (key == DCM_HighBit) return OFTrue; // also in Image Pixel Module
366   // if (key == DCM_SamplesPerPixel) return OFTrue; // also in Image Pixel Module
367   // if (key == DCM_PixelRepresentation) return OFTrue; // also in Image Pixel Module
368   // if (key == DCM_PhotometricInterpretation) return OFTrue; // also in Image Pixel Module
369   if (key == DCM_AcquisitionProtocolName) return OFTrue;
370   if (key == DCM_AcquisitionProtocolDescription) return OFTrue;
371   if (key == DCM_ScanOptions) return OFTrue;
372   // if (key == DCM_ContentQualification) return OFTrue;  // also in Enhanced MR Image Module
373   // if (key == DCM_PatientOrientationCodeSequence) return OFTrue; // also in General Image Module
374   if (key == DCM_PatientGantryRelationshipCodeSequence) return OFTrue;
375   if (key == DCM_ExaminedBodyThickness) return OFTrue;
376   // if (key == DCM_BurnedInAnnotation) return OFTrue; // also in General Image Module
377   // if (key == DCM_RecognizableVisualFeatures) return OFTrue; // also in General Image Module
378   // if (key == DCM_LossyImageCompression) return OFTrue; // also in General Image Module
379   // if (key == DCM_LossyImageCompressionRatio) return OFTrue; // also in General Image Module
380   // if (key == DCM_LossyImageCompressionMethod) return OFTrue; // also in General Image Module
381   if (key == DCM_ReferencedOtherPlaneSequence) return OFTrue;
382   // if (key == DCM_ReferencedImageEvidenceSequence) return OFTrue;  // also in Enhanced MR Image Module
383   // if (key == DCM_SourceImageEvidenceSequence) return OFTrue;  // also in Enhanced MR Image Module
384   // if (key == DCM_ReferencedInstanceSequence) return OFTrue; // also in SR Document General Module
385   // if (key == DCM_ImageComments) return OFTrue; // also in General Image Module
386   // if (key == DCM_QualityControlImage) return OFTrue; // also in General Image Module
387   // if (key == DCM_IconImageSequence) return OFTrue; // also in General Image Module
388   // if (key == DCM_PresentationLUTShape) return OFTrue; // also in General Image Module
389 
390   // any attributes of the Segmentation Image Module that are present
391   // if (key == DCM_ImageType) return OFTrue; // also in General Image Module
392   if (key == DCM_ImageOrientationSlide) return OFTrue;
393   // if (key == DCM_SamplesPerPixel) return OFTrue; // also in Image Pixel Module
394   // if (key == DCM_PhotometricInterpretation) return OFTrue; // also in Image Pixel Module
395   // if (key == DCM_PixelRepresentation) return OFTrue; // also in Image Pixel Module
396   // if (key == DCM_BitsAllocated) return OFTrue; // also in Image Pixel Module
397   // if (key == DCM_BitsStored) return OFTrue; // also in Image Pixel Module
398   // if (key == DCM_HighBit) return OFTrue; // also in Image Pixel Module
399   // if (key == DCM_LossyImageCompression) return OFTrue; // also in General Image Module
400   // if (key == DCM_LossyImageCompressionRatio) return OFTrue; // also in General Image Module
401   // if (key == DCM_LossyImageCompressionMethod) return OFTrue; // also in General Image Module
402   if (key == DCM_SegmentationType) return OFTrue;
403   if (key == DCM_SegmentationFractionalType) return OFTrue;
404   if (key == DCM_MaximumFractionalValue) return OFTrue;
405   if (key == DCM_SegmentsOverlap) return OFTrue;
406   if (key == DCM_SegmentSequence) return OFTrue;
407 
408   // any attributes of the Encapsulated Document Module that are present
409   // if (key == DCM_InstanceNumber) return OFTrue; // also in General Image Module
410   // if (key == DCM_ContentDate) return OFTrue; // also in General Image Module
411   // if (key == DCM_ContentTime) return OFTrue; // also in General Image Module
412   // if (key == DCM_AcquisitionDateTime) return OFTrue; // also in General Image Module
413   // if (key == DCM_ImageLaterality) return OFTrue; // also in General Image Module
414   // if (key == DCM_BurnedInAnnotation) return OFTrue; // also in General Image Module
415   // if (key == DCM_RecognizableVisualFeatures) return OFTrue; // also in General Image Module
416   if (key == DCM_SourceInstanceSequence) return OFTrue;
417   if (key == DCM_DocumentTitle) return OFTrue;
418   // if (key == DCM_ConceptNameCodeSequence) return OFTrue; // also in SR Document Content Module
419   if (key == DCM_DocumentClassCodeSequence) return OFTrue;
420   // if (key == DCM_VerificationFlag) return OFTrue; // also in SR Document General Module
421   if (key == DCM_HL7InstanceIdentifier) return OFTrue;
422   // if (key == DCM_PredecessorDocumentsSequence) return OFTrue; // also in SR Document General Module
423   // if (key == DCM_IdenticalDocumentsSequence) return OFTrue; // also in SR Document General Module
424   if (key == DCM_MIMETypeOfEncapsulatedDocument) return OFTrue;
425   if (key == DCM_ListOfMIMETypes) return OFTrue;
426   if (key == DCM_EncapsulatedDocument) return OFTrue;
427   if (key == DCM_EncapsulatedDocumentLength) return OFTrue;
428   // if (key == DCM_ValueType) return OFTrue; // also in SR Document Content Module
429   // if (key == DCM_ContentSequence) return OFTrue; // also in SR Document Content Module
430   // if (key == DCM_ContinuityOfContent) return OFTrue; // also in SR Document Content Module
431   // if (key == DCM_ContentTemplateSequence) return OFTrue; // also in SR Document Content Module
432 
433   // any attributes of the X-Ray 3D Image Module that are present
434   // if (key == DCM_ImageType) return OFTrue; // also in General Image Module
435   // if (key == DCM_BitsAllocated) return OFTrue; // also in Image Pixel Module
436   // if (key == DCM_BitsStored) return OFTrue; // also in Image Pixel Module
437   // if (key == DCM_HighBit) return OFTrue; // also in Image Pixel Module
438   // if (key == DCM_SamplesPerPixel) return OFTrue; // also in Image Pixel Module
439   // if (key == DCM_PhotometricInterpretation) return OFTrue; // also in Image Pixel Module
440   // if (key == DCM_ContentQualification) return OFTrue;  // also in Enhanced MR Image Module
441   // if (key == DCM_BurnedInAnnotation) return OFTrue; // also in General Image Module
442   // if (key == DCM_RecognizableVisualFeatures) return OFTrue; // also in General Image Module
443   // if (key == DCM_LossyImageCompression) return OFTrue; // also in General Image Module
444   // if (key == DCM_LossyImageCompressionRatio) return OFTrue; // also in General Image Module
445   // if (key == DCM_LossyImageCompressionMethod) return OFTrue; // also in General Image Module
446   // if (key == DCM_ReferencedImageEvidenceSequence) return OFTrue;  // also in Enhanced MR Image Module
447   // if (key == DCM_ImageComments) return OFTrue; // also in General Image Module
448   // if (key == DCM_QualityControlImage) return OFTrue; // also in General Image Module
449   // if (key == DCM_IconImageSequence) return OFTrue; // also in General Image Module
450   // if (key == DCM_PresentationLUTShape) return OFTrue; // also in General Image Module
451   if (key == DCM_SourceIrradiationEventSequence) return OFTrue;
452 
453   // any attributes of the Enhanced PET Image Module that are present
454   // if (key == DCM_ImageType) return OFTrue; // also in General Image Module
455   // if (key == DCM_AcquisitionNumber) return OFTrue; // also in General Image Module
456   // if (key == DCM_AcquisitionDateTime) return OFTrue; // also in General Image Module
457   // if (key == DCM_AcquisitionDuration) return OFTrue;  // also in Enhanced MR Image Module
458   // if (key == DCM_ReferencedRawDataSequence) return OFTrue;  // also in Enhanced MR Image Module
459   // if (key == DCM_ReferencedWaveformSequence) return OFTrue;  // also in Enhanced MR Image Module
460   // if (key == DCM_ReferencedImageEvidenceSequence) return OFTrue;  // also in Enhanced MR Image Module
461   // if (key == DCM_SourceImageEvidenceSequence) return OFTrue;  // also in Enhanced MR Image Module
462   // if (key == DCM_SamplesPerPixel) return OFTrue; // also in Image Pixel Module
463   // if (key == DCM_PhotometricInterpretation) return OFTrue; // also in Image Pixel Module
464   // if (key == DCM_BitsAllocated) return OFTrue; // also in Image Pixel Module
465   // if (key == DCM_BitsStored) return OFTrue; // also in Image Pixel Module
466   // if (key == DCM_HighBit) return OFTrue; // also in Image Pixel Module
467   // if (key == DCM_ContentQualification) return OFTrue;  // also in Enhanced MR Image Module
468   // if (key == DCM_ImageComments) return OFTrue; // also in General Image Module
469   // if (key == DCM_BurnedInAnnotation) return OFTrue; // also in General Image Module
470   // if (key == DCM_RecognizableVisualFeatures) return OFTrue; // also in General Image Module
471   // if (key == DCM_LossyImageCompression) return OFTrue; // also in General Image Module
472   // if (key == DCM_LossyImageCompressionRatio) return OFTrue; // also in General Image Module
473   // if (key == DCM_LossyImageCompressionMethod) return OFTrue; // also in General Image Module
474   // if (key == DCM_PresentationLUTShape) return OFTrue; // also in General Image Module
475   // if (key == DCM_IconImageSequence) return OFTrue; // also in General Image Module
476 
477   // any attributes of the Enhanced US Image Module that are present
478   // if (key == DCM_ImageType) return OFTrue; // also in General Image Module
479   // if (key == DCM_SamplesPerPixel) return OFTrue; // also in Image Pixel Module
480   // if (key == DCM_PhotometricInterpretation) return OFTrue; // also in Image Pixel Module
481   // if (key == DCM_BitsAllocated) return OFTrue; // also in Image Pixel Module
482   // if (key == DCM_BitsStored) return OFTrue; // also in Image Pixel Module
483   // if (key == DCM_HighBit) return OFTrue; // also in Image Pixel Module
484   // if (key == DCM_PixelRepresentation) return OFTrue; // also in Image Pixel Module
485   if (key == DCM_DimensionOrganizationType) return OFTrue;
486   // if (key == DCM_AcquisitionDateTime) return OFTrue; // also in General Image Module
487   // if (key == DCM_AcquisitionDuration) return OFTrue;  // also in Enhanced MR Image Module
488   if (key == DCM_PositionMeasuringDeviceUsed) return OFTrue;
489   // if (key == DCM_LossyImageCompression) return OFTrue; // also in General Image Module
490   // if (key == DCM_LossyImageCompressionRatio) return OFTrue; // also in General Image Module
491   // if (key == DCM_LossyImageCompressionMethod) return OFTrue; // also in General Image Module
492   // if (key == DCM_PresentationLUTShape) return OFTrue; // also in General Image Module
493   if (key == DCM_RescaleIntercept) return OFTrue;
494   if (key == DCM_RescaleSlope) return OFTrue;
495   if (key == DCM_SourceImageSequence) return OFTrue;
496   if (key == DCM_ReferencedImageSequence) return OFTrue;
497   // if (key == DCM_ReferencedRawDataSequence) return OFTrue;  // also in Enhanced MR Image Module
498   // if (key == DCM_ReferencedInstanceSequence) return OFTrue; // also in SR Document General Module
499   if (key == DCM_NumberOfStages) return OFTrue;
500   if (key == DCM_StageNumber) return OFTrue;
501   if (key == DCM_StageCodeSequence) return OFTrue;
502   if (key == DCM_EventTimerSequence) return OFTrue;
503   // if (key == DCM_BurnedInAnnotation) return OFTrue; // also in General Image Module
504   // if (key == DCM_RecognizableVisualFeatures) return OFTrue; // also in General Image Module
505   // if (key == DCM_IconImageSequence) return OFTrue; // also in General Image Module
506   if (key == DCM_TransducerData) return OFTrue;
507   if (key == DCM_TransducerGeometryCodeSequence) return OFTrue;
508   if (key == DCM_TransducerBeamSteeringCodeSequence) return OFTrue;
509   if (key == DCM_TransducerApplicationCodeSequence) return OFTrue;
510   if (key == DCM_ProcessingFunction) return OFTrue;
511   if (key == DCM_MechanicalIndex) return OFTrue;
512   if (key == DCM_BoneThermalIndex) return OFTrue;
513   if (key == DCM_CranialThermalIndex) return OFTrue;
514   if (key == DCM_SoftTissueThermalIndex) return OFTrue;
515   if (key == DCM_DepthsOfFocus) return OFTrue;
516   if (key == DCM_DepthOfScanField) return OFTrue;
517 
518   // any attributes of the Surface Segmentation Module that are present
519   // if (key == DCM_InstanceNumber) return OFTrue; // also in General Image Module
520   // if (key == DCM_ContentLabel) return OFTrue; // also in Raw Data Module
521   // if (key == DCM_ContentDescription) return OFTrue; // also in Raw Data Module
522   // if (key == DCM_ConceptNameCodeSequence) return OFTrue; // also in SR Document Content Module
523   if (key == DCM_AlternateContentDescriptionSequence) return OFTrue;
524   if (key == DCM_ContentCreatorName) return OFTrue;
525   if (key == DCM_ContentCreatorIdentificationCodeSequence) return OFTrue;
526   // if (key == DCM_ContentDate) return OFTrue; // also in General Image Module
527   // if (key == DCM_ContentTime) return OFTrue; // also in General Image Module
528   // if (key == DCM_SegmentSequence) return OFTrue; // also in Segmentation Image Module
529 
530   // any attributes of the Surface Mesh Module that are present
531   if (key == DCM_NumberOfSurfaces) return OFTrue;
532   if (key == DCM_SurfaceSequence) return OFTrue;
533 
534   // any attributes of the Structured Display Module that are present
535   // if (key == DCM_InstanceNumber) return OFTrue; // also in General Image Module
536   // if (key == DCM_ContentLabel) return OFTrue; // also in Raw Data Module
537   // if (key == DCM_ContentDescription) return OFTrue; // also in Raw Data Module
538   // if (key == DCM_ConceptNameCodeSequence) return OFTrue; // also in SR Document Content Module
539   // if (key == DCM_AlternateContentDescriptionSequence) return OFTrue; // also in Surface Segmentation Module
540   // if (key == DCM_ContentCreatorName) return OFTrue; // also in Surface Segmentation Module
541   // if (key == DCM_ContentCreatorIdentificationCodeSequence) return OFTrue; // also in Surface Segmentation Module
542   if (key == DCM_PresentationCreationDate) return OFTrue;
543   if (key == DCM_PresentationCreationTime) return OFTrue;
544   if (key == DCM_NumberOfScreens) return OFTrue;
545   if (key == DCM_NominalScreenDefinitionSequence) return OFTrue;
546   // if (key == DCM_IconImageSequence) return OFTrue; // also in General Image Module
547   if (key == DCM_StructuredDisplayBackgroundCIELabValue) return OFTrue;
548   if (key == DCM_EmptyImageBoxCIELabValue) return OFTrue;
549   if (key == DCM_HangingProtocolName) return OFTrue;
550   if (key == DCM_HangingProtocolCreator) return OFTrue;
551 
552   // any attributes of the Structured Display Annotation Module that are present
553   if (key == DCM_StructuredDisplayTextBoxSequence) return OFTrue;
554 
555   // any attributes of the Structured Display Image Box Module that are present
556   if (key == DCM_StructuredDisplayImageBoxSequence) return OFTrue;
557   if (key == DCM_ImageBoxSynchronizationSequence) return OFTrue;
558 
559   // any Attributes of the Implant Template Module that are present
560   // if (key == DCM_Manufacturer) return OFTrue; // also in General Equipment Module
561   if (key == DCM_FrameOfReferenceUID) return OFTrue;
562   if (key == DCM_ImplantName) return OFTrue;
563   if (key == DCM_ImplantSize) return OFTrue;
564   if (key == DCM_ImplantPartNumber) return OFTrue;
565   if (key == DCM_ImplantTemplateVersion) return OFTrue;
566   if (key == DCM_ReplacedImplantTemplateSequence) return OFTrue;
567   if (key == DCM_ImplantType) return OFTrue;
568   if (key == DCM_OriginalImplantTemplateSequence) return OFTrue;
569   if (key == DCM_DerivationImplantTemplateSequence) return OFTrue;
570   if (key == DCM_EffectiveDateTime) return OFTrue;
571   if (key == DCM_ImplantTargetAnatomySequence) return OFTrue;
572   if (key == DCM_NotificationFromManufacturerSequence) return OFTrue;
573   if (key == DCM_InformationFromManufacturerSequence) return OFTrue;
574   if (key == DCM_ImplantRegulatoryDisapprovalCodeSequence) return OFTrue;
575   if (key == DCM_OverallTemplateSpatialTolerance) return OFTrue;
576   if (key == DCM_MaterialsCodeSequence) return OFTrue;
577   if (key == DCM_CoatingMaterialsCodeSequence) return OFTrue;
578   if (key == DCM_ImplantTypeCodeSequence) return OFTrue;
579   if (key == DCM_FixationMethodCodeSequence) return OFTrue;
580 
581   // any Attributes of the Implant Assembly Template Module that are present
582   // if (key == DCM_EffectiveDateTime) return OFTrue; // also in Implant Template Module
583   if (key == DCM_ImplantAssemblyTemplateName) return OFTrue;
584   if (key == DCM_ImplantAssemblyTemplateIssuer) return OFTrue;
585   if (key == DCM_ImplantAssemblyTemplateVersion) return OFTrue;
586   if (key == DCM_ReplacedImplantAssemblyTemplateSequence) return OFTrue;
587   if (key == DCM_ImplantAssemblyTemplateType) return OFTrue;
588   if (key == DCM_OriginalImplantAssemblyTemplateSequence) return OFTrue;
589   if (key == DCM_DerivationImplantAssemblyTemplateSequence) return OFTrue;
590   if (key == DCM_ImplantAssemblyTemplateTargetAnatomySequence) return OFTrue;
591   if (key == DCM_ProcedureTypeCodeSequence) return OFTrue;
592   if (key == DCM_SurgicalTechnique) return OFTrue;
593   // if (key == DCM_MIMETypeOfEncapsulatedDocument) return OFTrue; // also in Encapsulated Document Module
594   // if (key == DCM_EncapsulatedDocument) return OFTrue; // also in Encapsulated Document Module
595   if (key == DCM_ComponentTypesSequence) return OFTrue;
596   if (key == DCM_ComponentAssemblySequence) return OFTrue;
597 
598   // any Attributes of the Implant Template Group Module that are present
599   // if (key == DCM_EffectiveDateTime) return OFTrue; // also in Implant Template Module
600   if (key == DCM_ImplantTemplateGroupName) return OFTrue;
601   if (key == DCM_ImplantTemplateGroupDescription) return OFTrue;
602   if (key == DCM_ImplantTemplateGroupIssuer) return OFTrue;
603   if (key == DCM_ImplantTemplateGroupVersion) return OFTrue;
604   if (key == DCM_ReplacedImplantTemplateGroupSequence) return OFTrue;
605   if (key == DCM_ImplantTemplateGroupTargetAnatomySequence) return OFTrue;
606   if (key == DCM_ImplantTemplateGroupMembersSequence) return OFTrue;
607   if (key == DCM_ImplantTemplateGroupVariationDimensionSequence) return OFTrue;
608 
609   // any attributes of the Point Cloud Module that are present
610   if (key == DCM_SurfacePointsSequence) return OFTrue;
611   if (key == DCM_SurfacePointPresentationValueData) return OFTrue;
612   if (key == DCM_SurfacePointColorCIELabValueData) return OFTrue;
613 
614   // any attributes of the Enhanced Mammography Image Module that are present
615   if (key == DCM_PositionerMotion) return OFTrue;
616   if (key == DCM_PositionerType) return OFTrue;
617   // if (key == DCM_ContentQualification) return OFTrue;  // also in Enhanced MR Image Module
618   // if (key == DCM_AcquisitionDateTime) return OFTrue; // also in General Image Module
619   // if (key == DCM_AcquisitionDuration) return OFTrue;  // also in Enhanced MR Image Module
620   if (key == DCM_KVP) return OFTrue;
621   if (key == DCM_XRayTubeCurrentInmA) return OFTrue;
622   if (key == DCM_ExposureTimeInms) return OFTrue;
623   if (key == DCM_ExposureInmAs) return OFTrue;
624   if (key == DCM_FocalSpots) return OFTrue;
625   if (key == DCM_AnodeTargetMaterial) return OFTrue;
626   if (key == DCM_BodyPartThickness) return OFTrue;
627   if (key == DCM_CompressionForce) return OFTrue;
628   if (key == DCM_CompressionPressure) return OFTrue;
629   if (key == DCM_CompressionContactArea) return OFTrue;
630   if (key == DCM_PaddleDescription) return OFTrue;
631   if (key == DCM_ExposureControlMode) return OFTrue;
632   if (key == DCM_ExposureControlModeDescription) return OFTrue;
633   if (key == DCM_PatientOrientation) return OFTrue;
634   // if (key == DCM_ImageComments) return OFTrue; // also in General Image Module
635   // if (key == DCM_SamplesPerPixel) return OFTrue; // also in Image Pixel Module
636   // if (key == DCM_PhotometricInterpretation) return OFTrue; // also in Image Pixel Module
637   // if (key == DCM_BitsAllocated) return OFTrue; // also in Image Pixel Module
638   // if (key == DCM_BitsStored) return OFTrue; // also in Image Pixel Module
639   // if (key == DCM_HighBit) return OFTrue; // also in Image Pixel Module
640   // if (key == DCM_PixelRepresentation) return OFTrue; // also in Image Pixel Module
641   // if (key == DCM_QualityControlImage) return OFTrue; // also in General Image Module
642   // if (key == DCM_BurnedInAnnotation) return OFTrue; // also in General Image Module
643   // if (key == DCM_LossyImageCompression) return OFTrue; // also in General Image Module
644   // if (key == DCM_LossyImageCompressionRatio) return OFTrue; // also in General Image Module
645   // if (key == DCM_LossyImageCompressionMethod) return OFTrue; // also in General Image Module
646   if (key == DCM_OrganDose) return OFTrue;
647   if (key == DCM_EntranceDoseInmGy) return OFTrue;
648   if (key == DCM_EntranceDoseDerivation) return OFTrue;
649   if (key == DCM_TypeOfDetectorMotion) return OFTrue;
650   // if (key == DCM_IconImageSequence) return OFTrue; // also in General Image Module
651   // if (key == DCM_PresentationLUTShape) return OFTrue; // also in General Image Module
652 
653   // any attributes of the Tractography Results Module that are present
654   // if (key == DCM_InstanceNumber) return OFTrue; // also in General Image Module
655   // if (key == DCM_ContentLabel) return OFTrue; // also in Raw Data Module
656   // if (key == DCM_ContentDescription) return OFTrue; // also in Raw Data Module
657   // if (key == DCM_ConceptNameCodeSequence) return OFTrue; // also in SR Document Content Module
658   // if (key == DCM_AlternateContentDescriptionSequence) return OFTrue; // also in Surface Segmentation Module
659   // if (key == DCM_ContentCreatorName) return OFTrue; // also in Surface Segmentation Module
660   // if (key == DCM_ContentCreatorIdentificationCodeSequence) return OFTrue; // also in Surface Segmentation Module
661   // if (key == DCM_ContentDate) return OFTrue; // also in General Image Module
662   // if (key == DCM_ContentTime) return OFTrue; // also in General Image Module
663   if (key == DCM_TrackSetSequence) return OFTrue;
664   // if (key == DCM_ReferencedInstanceSequence) return OFTrue; // also in SR Document General Module
665 
666   // any attributes of the Volumetric Graphic Annotation Module that are present
667   if (key == DCM_VolumetricAnnotationSequence) return OFTrue;
668   if (key == DCM_VolumetricPresentationInputAnnotationSequence) return OFTrue;
669 
670   return OFFalse;
671 }
672 
673 
checkRequiredAttributeList(DcmAttributeTag & tagList) const674 OFBool SiCreatorProfile::checkRequiredAttributeList(DcmAttributeTag& tagList) const
675 {
676   OFBool result =
677     containsTag(tagList, DCM_SOPClassUID) &&
678     containsTag(tagList, DCM_StudyInstanceUID) &&
679     containsTag(tagList, DCM_SeriesInstanceUID) &&
680     containsTag(tagList, DCM_SOPInstanceUID);
681 
682   return result;
683 }
684 
685 
inspectSignatureDataset(DcmItem & item)686 OFCondition SiCreatorProfile::inspectSignatureDataset(DcmItem &item)
687 {
688   DcmElement *delem = NULL;
689   if (item.findAndGetElement(DCM_CreatorVersionUID, delem).good())
690   {
691     // The CreatorVersionUID attribute is present in the dataset or item.
692     // Since this attribute only occurs in the Raw Data Module, this means that
693     // the Raw Data Module is present.
694     containsRawData_ = OFTrue;
695   }
696   else
697   {
698     containsRawData_ = OFFalse;
699   }
700   return EC_Normal;
701 }
702 
mainDatasetRequired() const703 OFBool SiCreatorProfile::mainDatasetRequired() const
704 {
705   return OFTrue;
706 }
707 
708 #else /* WITH_OPENSSL */
709 
710 int sicreapr_cc_dummy_to_keep_linker_from_moaning = 0;
711 
712 #endif
713