OFFIS DCMTK  Version 3.6.0
dcddirif.h
1 /*
2  *
3  * Copyright (C) 2002-2010, 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: dcmdata
15  *
16  * Author: Joerg Riesmeier
17  *
18  * Purpose: Interface class for simplified creation of a DICOMDIR
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-11-05 13:11:11 $
22  * CVS/RCS Revision: $Revision: 1.23 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 
30 #ifndef DCDDIRIF_H
31 #define DCDDIRIF_H
32 
33 #include "dcmtk/config/osconfig.h"
34 
35 #include "dcmtk/dcmdata/dcdicdir.h"
36 
37 
38 /*-----------------------------------*
39  * contant declarations and macros *
40  *-----------------------------------*/
41 
42 // default fileset ID
43 #define DEFAULT_FILESETID "DCMTK_MEDIA_DEMO"
44 // default specific character set of fileset descriptor file
45 #define DEFAULT_DESCRIPTOR_CHARSET "ISO_IR 100"
46 
47 
48 /*----------------------*
49  * class declarations *
50  *----------------------*/
51 
58 {
59  public:
60 
63  virtual ~DicomDirImagePlugin() {}
64 
75  virtual OFBool scaleData(const Uint8 *srcData,
76  const unsigned int srcWidth,
77  const unsigned int srcHeight,
78  Uint8 *dstData,
79  const unsigned int dstWidth,
80  const unsigned int dstHeight) const = 0;
81 
93  virtual OFBool scaleImage(DcmItem *dataset,
94  Uint8 *pixel,
95  const unsigned long count,
96  const unsigned long frame,
97  const unsigned int width,
98  const unsigned int height,
99  const OFBool decompressAll = OFFalse) const = 0;
100 
101  protected:
102 
106 };
107 
108 
112 {
113 
114  public:
115 
119  {
158  };
159 
165 
169  virtual ~DicomDirInterface();
170 
174  void cleanup();
175 
180  OFBool isDicomDirValid() const;
181 
194  const char *filename = DEFAULT_DICOMDIR_NAME,
195  const char *filesetID = DEFAULT_FILESETID);
196 
209  const char *filename);
210 
223  const char *filename);
224 
231  OFCondition writeDicomDir(const E_EncodingType encodingType = EET_UndefinedLength,
232  const E_GrpLenEncoding groupLength = EGL_withoutGL);
233 
243  OFBool isFilenameValid(const char *filename,
244  const OFBool allowEmpty = OFFalse);
245 
253  OFBool isCharsetValid(const char *charset);
254 
265  OFCondition checkDicomFile(const char *filename,
266  const char *directory = NULL);
267 
277  OFCondition addDicomFile(const char *filename,
278  const char *directory = NULL);
279 
289  OFCondition setFilesetDescriptor(const char *filename,
290  const char *charset = DEFAULT_DESCRIPTOR_CHARSET);
291 
298  OFCondition setIconSize(const unsigned int size);
299 
308  OFCondition setIconPrefix(const char *prefix);
309 
317  OFCondition setDefaultIcon(const char *filename);
318 
323  OFBool abortMode() const
324  {
325  return AbortMode;
326  }
327 
332  OFBool mapFilenamesMode() const
333  {
334  return MapFilenamesMode;
335  }
336 
341  OFBool inventMode() const
342  {
343  return InventMode;
344  }
345 
350  OFBool inventPatientIDMode() const
351  {
352  return InventPatientIDMode;
353  }
354 
359  OFBool retiredSOPClassSupport() const
360  {
361  return RetiredSOPClassSupport;
362  }
363 
368  OFBool iconImageMode() const
369  {
370  return IconImageMode;
371  }
372 
377  OFBool backupMode() const
378  {
379  return BackupMode;
380  }
381 
386  OFBool encodingCheck() const
387  {
388  return EncodingCheck;
389  }
390 
395  OFBool resolutionCheck() const
396  {
397  return ResolutionCheck;
398  }
399 
404  OFBool transferSyntaxCheck() const
405  {
406  return TransferSyntaxCheck;
407  }
408 
413  OFBool consistencyCheck() const
414  {
415  return ConsistencyCheck;
416  }
417 
425  OFBool enableAbortMode(const OFBool newMode = OFTrue);
426 
434  OFBool enableMapFilenamesMode(const OFBool newMode = OFTrue);
435 
443  OFBool enableInventMode(const OFBool newMode = OFTrue);
444 
453  OFBool enableInventPatientIDMode(const OFBool newMode = OFTrue);
454 
462  OFBool enableRetiredSOPClassSupport(const OFBool newMode = OFTrue);
463 
473  OFBool enableIconImageMode(const OFBool newMode = OFTrue);
474 
483  OFBool disableBackupMode(const OFBool newMode = OFFalse);
484 
494  OFBool disableEncodingCheck(const OFBool newMode = OFFalse);
495 
505  OFBool disableResolutionCheck(const OFBool newMode = OFFalse);
506 
516  OFBool disableTransferSyntaxCheck(const OFBool newMode = OFFalse);
517 
526  OFBool disableConsistencyCheck(const OFBool newMode = OFFalse);
527 
534  OFBool addImageSupport(DicomDirImagePlugin *plugin);
535 
536  /* -- static function -- */
537 
542  static const char *getProfileName(const E_ApplicationProfile profile);
543 
544 
545  protected:
546 
552 
559  OFCondition loadAndCheckDicomFile(const char *filename,
560  const char *directory,
561  DcmFileFormat &fileformat);
562 
570  DcmItem *dataset,
571  const char *filename);
572 
579  const char *filename);
580 
588  const OFString &sopClass,
589  const char *filename);
590 
597  const char *filename);
598 
606  const OFString &sopClass,
607  const char *filename);
608 
616  const OFString &transferSyntax,
617  const char *filename);
618 
626  DcmItem *dataset,
627  const char *filename);
628 
639  DcmItem *dataset);
640 
648  const E_DirRecType recordType,
649  DcmItem* dataset);
650 
658  DcmItem *dataset,
659  const OFString &sourceFilename);
660 
668  DcmItem *dataset,
669  const OFString &sourceFilename);
670 
678  DcmItem *dataset,
679  const OFString &sourceFilename);
680 
689  DcmItem *dataset,
690  const OFString &referencedFileID,
691  const OFString &sourceFilename);
692 
701  DcmItem *dataset,
702  const OFString &referencedFileID,
703  const OFString &sourceFilename);
704 
713  DcmItem *dataset,
714  const OFString &referencedFileID,
715  const OFString &sourceFilename);
716 
725  DcmItem *dataset,
726  const OFString &referencedFileID,
727  const OFString &sourceFilename);
728 
737  DcmItem *dataset,
738  const OFString &referencedFileID,
739  const OFString &sourceFilename);
740 
749  DcmItem *dataset,
750  const OFString &referencedFileID,
751  const OFString &sourceFilename);
752 
761  DcmItem *dataset,
762  const OFString &referencedFileID,
763  const OFString &sourceFilename);
764 
773  DcmItem *dataset,
774  const OFString &referencedFileID,
775  const OFString &sourceFilename);
776 
785  DcmItem *dataset,
786  const OFString &referencedFileID,
787  const OFString &sourceFilename);
788 
797  DcmItem *dataset,
798  const OFString &referencedFileID,
799  const OFString &sourceFilename);
800 
809  DcmItem *dataset,
810  const OFString &referencedFileID,
811  const OFString &sourceFilename);
812 
821  DcmItem *dataset,
822  const OFString &referencedFileID,
823  const OFString &sourceFilename);
824 
833  DcmItem *dataset,
834  const OFString &referencedFileID,
835  const OFString &sourceFilename);
836 
845  DcmItem *dataset,
846  const OFString &referencedFileID,
847  const OFString &sourceFilename);
848 
857  DcmItem *dataset,
858  const OFString &referencedFileID,
859  const OFString &sourceFilename);
860 
869  DcmItem *dataset,
870  const OFString &referencedFileID,
871  const OFString &sourceFilename);
872 
881  DcmItem *dataset,
882  const OFString &referencedFileID,
883  const OFString &sourceFilename);
884 
893  DcmItem *dataset,
894  const OFString &referencedFileID,
895  const OFString &sourceFilename);
896 
905  DcmItem *dataset,
906  const OFString &referencedFileID,
907  const OFString &sourceFilename);
908 
917  DcmItem *dataset,
918  const OFString &referencedFileID,
919  const OFString &sourceFilename);
920 
929  DcmItem *dataset,
930  const OFString &referencedFileID,
931  const OFString &sourceFilename);
932 
941  DcmItem *dataset,
942  const OFString &referencedFileID,
943  const OFString &sourceFilename);
944 
953  DcmItem *dataset,
954  const OFString &referencedFileID,
955  const OFString &sourceFilename);
956 
965  DcmItem *dataset,
966  const OFString &referencedFileID,
967  const OFString &sourceFilename);
968 
977  DcmItem *dataset,
978  const OFString &referencedFileID,
979  const OFString &sourceFilename);
980 
989  DcmItem *dataset,
990  const OFString &referencedFileID,
991  const OFString &sourceFilename);
992 
1001  DcmItem *dataset,
1002  const OFString &referencedFileID,
1003  const OFString &sourceFilename);
1004 
1013  DcmItem *dataset,
1014  const OFString &referencedFileID,
1015  const OFString &sourceFilename);
1016 
1027  OFBool getIconFromFile(const OFString &filename,
1028  Uint8 *pixel,
1029  const unsigned long count,
1030  const unsigned int width,
1031  const unsigned int height);
1032 
1042  OFBool getIconFromDataset(DcmItem *dataset,
1043  Uint8 *pixel,
1044  const unsigned long count,
1045  const unsigned int width,
1046  const unsigned int height);
1047 
1059  DcmItem *dataset,
1060  const unsigned int size,
1061  const OFString &sourceFilename);
1062 
1073  const E_DirRecType recordType,
1074  DcmItem *dataset,
1075  const OFString &referencedFileID,
1076  const OFString &sourceFilename);
1077 
1085  DcmItem *dataset,
1086  const OFString &referencedFileID,
1087  const OFString &sourceFilename);
1088 
1095  const OFBool recurse = OFTrue);
1096 
1101 
1106 
1111 
1115  void createDicomDirBackup(const char *filename);
1116 
1119  void deleteDicomDirBackup();
1120 
1128  void printUnexpectedValueMessage(const DcmTagKey &key,
1129  const char *filename = NULL,
1130  const OFBool errorMsg = OFTrue);
1131 
1139  void printRequiredAttributeMessage(const DcmTagKey &key,
1140  const char *filename = NULL,
1141  const OFBool emptyMsg = OFFalse);
1142 
1150  void printAttributeErrorMessage(const DcmTagKey &key,
1151  const OFCondition &error,
1152  const char *operation);
1153 
1161  void printRecordErrorMessage(const OFCondition &error,
1162  const E_DirRecType recordType,
1163  const char *operation);
1164 
1170  OFBool copyFile(const char *fromFilename,
1171  const char *toFilename);
1172 
1181  DcmItem *dataset,
1182  const OFString &sourceFilename,
1183  const OFBool abortCheck = OFFalse);
1184 
1189  OFBool checkFilesetID(const OFString &filesetID);
1190 
1197  OFBool checkExists(DcmItem *dataset,
1198  const DcmTagKey &key,
1199  const char *filename = NULL);
1200 
1207  OFBool checkExistsWithValue(DcmItem *dataset,
1208  const DcmTagKey &key,
1209  const char *filename = NULL);
1210 
1218  OFBool checkExistsWithStringValue(DcmItem *dataset,
1219  const DcmTagKey &key,
1220  const OFString &value,
1221  const char *filename = NULL);
1222 
1231  OFBool checkExistsWithIntegerValue(DcmItem *dataset,
1232  const DcmTagKey &key,
1233  const long value,
1234  const char *filename = NULL,
1235  const OFBool reject = OFTrue);
1236 
1246  OFBool checkExistsWithMinMaxValue(DcmItem *dataset,
1247  const DcmTagKey &key,
1248  const long min,
1249  const long max,
1250  const char *filename = NULL,
1251  const OFBool reject = OFTrue);
1252 
1261  const DcmTagKey &key,
1262  OFString &result,
1263  OFBool searchIntoSub = OFFalse);
1264 
1274  const DcmTagKey &key,
1275  OFString &result,
1276  const unsigned long pos,
1277  OFBool searchIntoSub = OFFalse);
1278 
1286  OFString &getStringFromFile(const char *filename,
1287  const DcmTagKey &key,
1288  OFString &result,
1289  OFBool searchIntoSub = OFFalse);
1290 
1299  void copyElement(DcmItem *dataset,
1300  const DcmTagKey &key,
1301  DcmDirectoryRecord *record,
1302  const OFString &sourceFilename,
1303  const OFBool optional = OFFalse,
1304  const OFBool copyEmpty = OFTrue);
1305 
1312  void copyElementType1(DcmItem *dataset,
1313  const DcmTagKey &key,
1314  DcmDirectoryRecord *record,
1315  const OFString &sourceFilename)
1316  {
1317  copyElement(dataset, key, record, sourceFilename, OFFalse /*optional*/, OFFalse /*copyEmpty*/);
1318  }
1319 
1327  const DcmTagKey &key,
1328  DcmDirectoryRecord *record,
1329  const OFString &sourceFilename)
1330  {
1331  copyElement(dataset, key, record, sourceFilename, OFTrue /*optional*/, OFFalse /*copyEmpty*/);
1332  }
1333 
1340  void copyElementType2(DcmItem *dataset,
1341  const DcmTagKey &key,
1342  DcmDirectoryRecord *record,
1343  const OFString &sourceFilename)
1344  {
1345  copyElement(dataset, key, record, sourceFilename, OFFalse /*optional*/, OFTrue /*copyEmpty*/);
1346  }
1347 
1354  void copyElementType3(DcmItem *dataset,
1355  const DcmTagKey &key,
1356  DcmDirectoryRecord *record,
1357  const OFString &sourceFilename)
1358  {
1359  copyElement(dataset, key, record, sourceFilename, OFTrue /*optional*/, OFTrue /*copyEmpty*/);
1360  }
1361 
1371  void copyStringWithDefault(DcmItem *dataset,
1372  const DcmTagKey &key,
1373  DcmDirectoryRecord *record,
1374  const OFString &sourceFilename,
1375  const char *defaultValue = "",
1376  const OFBool printWarning = OFFalse);
1377 
1387  OFBool compareStringAttributes(DcmItem *dataset,
1388  const DcmTagKey &datKey,
1389  DcmDirectoryRecord *record,
1390  const DcmTagKey &recKey,
1391  const OFString &sourceFilename,
1392  const OFBool errorMsg = OFFalse);
1393 
1401  OFBool compareSequenceAttributes(DcmItem *dataset,
1402  DcmTagKey &key,
1403  DcmDirectoryRecord *record,
1404  const OFString &sourceFilename);
1405 
1412  void setDefaultValue(DcmDirectoryRecord *record,
1413  const DcmTagKey &key,
1414  const unsigned long number,
1415  const char *prefix = NULL);
1416 
1417 
1418  private:
1419 
1422 
1425 
1428 
1430  OFBool BackupMode;
1432  OFBool AbortMode;
1436  OFBool InventMode;
1453 
1458 
1460  unsigned int IconSize;
1465 
1467  OFBool RLESupport;
1469  OFBool JPEGSupport;
1471  OFBool JP2KSupport;
1472 
1474  unsigned long AutoPatientNumber;
1476  unsigned long AutoStudyNumber;
1478  unsigned long AutoSeriesNumber;
1480  unsigned long AutoInstanceNumber;
1482  unsigned long AutoOverlayNumber;
1484  unsigned long AutoLutNumber;
1486  unsigned long AutoCurveNumber;
1487 
1490 
1493 };
1494 
1495 
1496 #endif
1497 
1498 
1499 /*
1500  *
1501  * CVS/RCS Log:
1502  * $Log: dcddirif.h,v $
1503  * Revision 1.23 2010-11-05 13:11:11 joergr
1504  * Added support for new directory record types IMPLANT, IMPLANT GROUP and
1505  * IMPLANT ASSY from Supplement 131 (Implant Templates).
1506  *
1507  * Revision 1.22 2010-10-14 13:15:40 joergr
1508  * Updated copyright header. Added reference to COPYRIGHT file.
1509  *
1510  * Revision 1.21 2010-10-04 16:14:53 joergr
1511  * Fixed various Doxygen API documentation issues.
1512  *
1513  * Revision 1.20 2010-10-01 08:09:31 joergr
1514  * Added support for new non-image Storage SOP Classes that require the new
1515  * directory record type MEASUREMENT. Also fixed issues with other record types.
1516  *
1517  * Revision 1.19 2010-09-30 17:18:10 joergr
1518  * Added support for new non-image Storage SOP Classes that require the new
1519  * directory record types PALETTE and SURFACE. Also updated existing records.
1520  *
1521  * Revision 1.18 2010-08-10 11:02:58 uli
1522  * Removed undefined function printFileErrorMessage().
1523  *
1524  * Revision 1.17 2010-08-09 13:02:56 joergr
1525  * Updated data dictionary to 2009 edition of the DICOM standard. From now on,
1526  * the official "keyword" is used for the attribute name which results in a
1527  * number of minor changes (e.g. "PatientsName" is now called "PatientName").
1528  *
1529  * Revision 1.16 2009-11-25 13:31:05 joergr
1530  * Adapted code for new approach to access individual frames of a DICOM image.
1531  *
1532  * Revision 1.15 2009-11-04 09:58:07 uli
1533  * Switched to logging mechanism provided by the "new" oflog module
1534  *
1535  * Revision 1.14 2009-01-15 10:16:40 joergr
1536  * Added check whether (possibly required) JPEG 2000 decoder is registered.
1537  *
1538  * Revision 1.13 2008-06-23 12:05:37 joergr
1539  * Added check on value representation of data elements copied from the
1540  * referenced DICOM file to the DICOMDIR (compare VR with data dictionary).
1541  *
1542  * Revision 1.12 2007/02/02 16:01:51 joergr
1543  * Added error message when existing SOP instance is inconsistent with new
1544  * directory record in update mode (e.g. different SOP class UID).
1545  * Fixed incomplete warning message in update mode (filename was missing).
1546  *
1547  * Revision 1.11 2007/01/10 13:02:59 joergr
1548  * Added new option that enables support for retired SOP classes.
1549  *
1550  * Revision 1.10 2006/12/15 14:56:57 joergr
1551  * Added new option that allows to update existing entries in a DICOMDIR. This
1552  * also adds support for mixed media stored application profiles.
1553  * Changed name of enum value for the MPEG2-DVD application profile in order to
1554  * be more consistent with other names.
1555  * Slightly revised handling of type 1, 1C and 2 elements in Directory Records.
1556  * Fixed small bug in cardiac application profiles when checking the ImageType
1557  * (0008,0008).
1558  *
1559  * Revision 1.9 2006/07/27 13:05:05 joergr
1560  * Added support for DICOMDIR record type "STEREOMETRIC" (CP 628).
1561  *
1562  * Revision 1.8 2005/12/15 15:40:48 joergr
1563  * Removed unsused parameter.
1564  *
1565  * Revision 1.7 2005/12/08 16:28:03 meichel
1566  * Changed include path schema for all DCMTK header files
1567  *
1568  * Revision 1.6 2005/10/27 13:31:21 joergr
1569  * Added support for Encapsulated Document, Real World Value Mapping and
1570  * Hanging Protocol objects to DICOMDIR tools.
1571  *
1572  * Revision 1.5 2005/06/13 14:36:41 joergr
1573  * Added new options to disable check on pixel encoding and transfer syntax.
1574  *
1575  * Revision 1.4 2005/03/09 17:53:34 joergr
1576  * Added support for new Media Storage Application Profiles according to DICOM
1577  * PS 3.12-2004. Removed support for non-standard conformant "No profile".
1578  * Added support for UTF-8 for the contents of the fileset descriptor file.
1579  *
1580  * Revision 1.3 2004/02/13 17:36:46 joergr
1581  * Added support for new directory records RAW DATA and SPECTROSCOPY introduced
1582  * with CP 343.
1583  *
1584  * Revision 1.2 2004/02/13 14:11:15 joergr
1585  * Added support for new directory records REGISTRATION and FIDUCIAL introduced
1586  * with supplement 73 (Spatial Registration Storage SOP Classes).
1587  *
1588  * Revision 1.1 2003/08/12 14:35:00 joergr
1589  * Added new interface class for simplified creation of a DICOMDIR.
1590  *
1591  *
1592  */


Generated on Thu Dec 20 2012 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.2