📄 dcddirif.h
字号:
/* * * Copyright (C) 2002-2005, OFFIS * * This software and supporting documentation were developed by * * Kuratorium OFFIS e.V. * Healthcare Information and Communication Systems * Escherweg 2 * D-26121 Oldenburg, Germany * * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. * * Module: dcmdata * * Author: Joerg Riesmeier * * Purpose: Interface class for simplified creation of a DICOMDIR * * Last Update: $Author: joergr $ * Update Date: $Date: 2005/12/15 15:40:48 $ * CVS/RCS Revision: $Revision: 1.8 $ * Status: $State: Exp $ * * CVS/RCS Log at end of file * */#ifndef DCDDIRIF_H#define DCDDIRIF_H#include "dcmtk/config/osconfig.h"#include "dcmtk/dcmdata/dcdicdir.h"/*-----------------------------------* * contant declarations and macros * *-----------------------------------*/// default fileset ID#define DEFAULT_FILESETID "DCMTK_MEDIA_DEMO"// default specific character set of fileset descriptor file#define DEFAULT_DESCRIPTOR_CHARSET "ISO_IR 100"/*----------------------* * class declarations * *----------------------*//** Abstract interface to plugable image support for the DICOMDIR class. * This is an abstract base class used as an interface to access DICOM * images from the DicomDirInterface. The implementation can be found * in dcmjpeg/libsrc/ddpiimpl.cc (incl. JPEG support). */class DicomDirImagePlugin{ public: /** destructor (virtual) */ virtual ~DicomDirImagePlugin() {} /** scale image (pixel data) to specified size * @param srcData pointer to 8 bit source pixel data (original image) * @param srcWidth width of the source image * @param srcHeight height of the source image * @param dstData pointer to 8 bit destination pixel data (scaled image). * This array needs to be allocated prior to calling this function. * @param dstWidth width of the destination image * @param dstHeight height of the destination image * @return OFTrue if successful, OFFalse otherwise */ virtual OFBool scaleData(const Uint8 *srcData, const unsigned int srcWidth, const unsigned int srcHeight, Uint8 *dstData, const unsigned int dstWidth, const unsigned int dstHeight) const = 0; /** scale image (from DICOM dataset) to specified size * @param dataset DICOM dataset where the pixel data is stored (original image) * @param pixel pointer to 8 bit destination pixel data (scaled image). * This array needs to be allocated prior to calling this function. * @param count number of bytes allocated for the 'pixel' array * @param frame index of the frame to be scaled (0..n-1) * @param width width of the destination image * @param height height of the destination image * @return OFTrue if successful, OFFalse otherwise */ virtual OFBool scaleImage(DcmItem *dataset, Uint8 *pixel, const unsigned long count, const unsigned long frame, const unsigned int width, const unsigned int height) const = 0; protected: /** constructor (protected) */ DicomDirImagePlugin() {}};/** An interface class for simplified creation of a DICOMDIR */class DicomDirInterface{ public: /** list of supported media storage application profiles */ enum E_ApplicationProfile { /// General Purpose Interchange on CD-R or DVD-RAM Media (STD-GEN-CD/DVD-RAM) AP_GeneralPurpose, /// default application profile: GeneralPurpose AP_Default = AP_GeneralPurpose, /// General Purpose DVD with Compression Interchange (STD-GEN-DVD) AP_GeneralPurposeDVD, /// General Purpose MIME Interchange Profile (STD-GEN-MIME) AP_GeneralPurposeMIME, /// General Purpose USB and Flash Memory with Compression Interchange (STD-GEN-USB/MMC/CF/SD-JPEG/J2K) AP_USBandFlash, /// DVD Interchange with MPEG2 MP@ML (STD-DVD-MPEG2-MPML) AP_MPEG2MPatML, /// Basic Cardiac X-Ray Angiographic Studies on CD-R Media (STD-XABC-CD) AP_BasicCardiac, /// 1024 X-Ray Angiographic Studies on CD-R Media (STD-XA1K-CD) AP_XrayAngiographic, /// 1024 X-Ray Angiographic Studies on DVD Media (STD-XA1K-DVD) AP_XrayAngiographicDVD, /// Dental Radiograph Interchange (STD-DEN-CD) AP_DentalRadiograph, /// CT/MR Studies (STD-CTMR-xxxx) AP_CTandMR, /// Ultrasound Single Frame for Image Display (STD-US-ID-SF-xxxx) AP_UltrasoundIDSF, /// Ultrasound Single Frame with Spatial Calibration (STD-US-SC-SF-xxxx) AP_UltrasoundSCSF, /// Ultrasound Single Frame with Combined Calibration (STD-US-CC-SF-xxxx) AP_UltrasoundCCSF, /// Ultrasound Single & Multi-Frame for Image Display (STD-US-ID-MF-xxxx) AP_UltrasoundIDMF, /// Ultrasound Single & Multi-Frame with Spatial Calibration (STD-UD-SC-MF-xxxx) AP_UltrasoundSCMF, /// Ultrasound Single & Multi-Frame with Combined Calibration (STD-UD-CC-MF-xxxx) AP_UltrasoundCCMF, /// 12-lead ECG Interchange on Diskette (STD-WVFM-ECG-FD) AP_TwelveLeadECG, /// Hemodynamic Waveform Interchange on Diskette (STD-WVFM-HD-FD) AP_HemodynamicWaveform }; /** constructor (default). * No DICOMDIR object is created by default (see methods createNewDicomDir and * appendToDicomDir). */ DicomDirInterface(); /** destructor (virtual). * Free all memory allocated by this class. */ virtual ~DicomDirInterface(); /** reset the object to its initial state. * That means e.g. free memory. */ void cleanup(); /** check whether current DICOMDIR is valid. * That means e.g. that it can be written to a file. * @return OFTrue if DICOMDIR is valid, OFFalse otherwise */ OFBool isDicomDirValid() const; /** create a new DICOMDIR object. * This function replaces any previously existing DICOMDIR file with the specified * 'filename'. If the backup mode (see 'enableBackupMode') is enabled a backup * copy ('filename' + ".BAK") is created from the existing file and automatically * deleted after the new file has been written without any errors. * @param profile media storage application profile to be used for the DICOMDIR * @param filename name of the DICOMDIR file to be created (default: 'DICOMDIR'). * The filename may include a fully qualified pathname. * @param filesetID value of the attribute FileSetID (default: 'DCMTK_MEDIA_DEMO') * @return EC_Normal upon success, an error code otherwise */ OFCondition createNewDicomDir(const E_ApplicationProfile profile = AP_GeneralPurpose, const char *filename = DEFAULT_DICOMDIR_NAME, const char *filesetID = DEFAULT_FILESETID); /** create a DICOMDIR object based on an existing DICOMDIR file. * This function can be used to append new entries to an existing DICOMDIR file. * If the backup mode (see 'enableBackupMode') is enabled a backup copy ('filename' * + ".BAK") is created from the existing file and automatically deleted after the * new file has been written without any errors. * @param profile media storage application profile to be used for the DICOMDIR. * NB: The same profile should be used as for the creation of the DICOMDIR file. * @param filename name of the DICOMDIR file to be appended. The filename may * include a fully qualified pathname. * @return EC_Normal upon success, an error code otherwise */ OFCondition appendToDicomDir(const E_ApplicationProfile profile, const char *filename); /** write the current DICOMDIR object to file. * NB: The filename has already been specified for the object creation (see above). * @param encodingType flag, specifying the encoding with undefined or explicit length * @param groupLength flag, specifying how to handle the group length tags * @return EC_Normal upon success, an error code otherwise */ OFCondition writeDicomDir(const E_EncodingType encodingType = EET_UndefinedLength, const E_GrpLenEncoding groupLength = EGL_withoutGL); /** check whether specified filename is valid. i.e. conforms to the DICOM standard * requirements (length, number of component and proper characters). This function * is called automatically for the following methods: checkDicomFile(), addDicomFile() * and setFilesetDescriptor(). So usually there's no need to call it manually * (especially not in addition to the above mentioned methods). * @param filename filename to be checked for standard conformance * @param allowEmpty empty filename (zero length) allowed if OFTrue * @return OFTrue if filename is valid, OFFalse otherwise */ OFBool isFilenameValid(const char *filename, const OFBool allowEmpty = OFFalse); /** check whether given charset identifier is valid. * Valid character sets are (see DICOM PS3.3 for details): ISO_IR 100, ISO_IR 101, * ISO_IR 109, ISO_IR 110, ISO_IR 144, ISO_IR 127, ISO_IR 126, ISO_IR 138, ISO_IR 148, * ISO_IR 166, ISO_IR 13, ISO_IR 192. * @param charset character set identifier to be checked * @return OFTrue if charset is valid, OFFalse otherwise */ OFBool isCharsetValid(const char *charset); /** check whether specified DICOM file is suitable to be included into the DICOMDIR. * This method loads the given file and checks whether it conforms to the current * application profile. Since this check is also performed by addDicomFile() there * is usually no need to call this method directly. * @param filename name of the DICOM file to be checked * @param directory directory where the DICOM file is stored (optional). * This parameter might be useful in cases where the DICOM file is not (yet) * stored in the final directory (i.e. "relative" to the DICOMDIR location). * @return EC_Normal upon success, an error code otherwise */ OFCondition checkDicomFile(const char *filename, const char *directory = NULL); /** add specified DICOM file to the current DICOMDIR. * This method loads the given file, checks whether it conforms to the current * application profile and finally adds it to the DICOMDIR (in case of conformance). * @param filename name of the DICOM file to be added * @param directory directory where the DICOM file is stored (optional). * This parameter might be useful in cases where the DICOM file is not (yet) * stored in the final directory (i.e. "relative" to the DICOMDIR location). * @return EC_Normal upon success, an error code otherwise */ OFCondition addDicomFile(const char *filename, const char *directory = NULL); /** set the fileset descriptor file ID and character set.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -