# gdcmMediaStorage.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004   Module:  $URL$
    00005
    00006   Copyright (c) 2006-2009 Mathieu Malaterre
    00007   All rights reserved.
    00008   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
    00009
    00010      This software is distributed WITHOUT ANY WARRANTY; without even
    00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00012      PURPOSE.  See the above copyright notice for more information.
    00013
    00014 =========================================================================*/
    00015 #ifndef __gdcmMediaStorage_h
    00016 #define __gdcmMediaStorage_h
    00017
    00018 #include "gdcmTransferSyntax.h"
    00019
    00020 namespace gdcm
    00021 {
    00022
    00023 class DataSet;
    00024 class Tag;
    00025 class FileMetaInformation;
    00026 class File;
    00036 class GDCM_EXPORT MediaStorage
    00037 {
    00038 public:
    00039   typedef enum {
    00040     MediaStorageDirectoryStorage = 0,
    00041     ComputedRadiographyImageStorage,
    00042     DigitalXRayImageStorageForPresentation,
    00043     DigitalXRayImageStorageForProcessing,
    00044     DigitalMammographyImageStorageForPresentation,
    00045     DigitalMammographyImageStorageForProcessing,
    00046     DigitalIntraoralXrayImageStorageForPresentation,
    00047     DigitalIntraoralXRayImageStorageForProcessing,
    00048     CTImageStorage,
    00049     EnhancedCTImageStorage,
    00050     UltrasoundImageStorageRetired,
    00051     UltrasoundImageStorage,
    00052     UltrasoundMultiFrameImageStorageRetired,
    00053     UltrasoundMultiFrameImageStorage,
    00054     MRImageStorage,
    00055     EnhancedMRImageStorage,
    00056     MRSpectroscopyStorage,
    00057     NuclearMedicineImageStorageRetired,
    00058     SecondaryCaptureImageStorage,
    00059     MultiframeSingleBitSecondaryCaptureImageStorage,
    00060     MultiframeGrayscaleByteSecondaryCaptureImageStorage,
    00061     MultiframeGrayscaleWordSecondaryCaptureImageStorage,
    00062     MultiframeTrueColorSecondaryCaptureImageStorage,
    00063     StandaloneOverlayStorage,
    00064     StandaloneCurveStorage,
    00065     LeadECGWaveformStorage, // 12-
    00066     GeneralECGWaveformStorage,
    00067     AmbulatoryECGWaveformStorage,
    00068     HemodynamicWaveformStorage,
    00069     CardiacElectrophysiologyWaveformStorage,
    00070     BasicVoiceAudioWaveformStorage,
    00071     StandaloneModalityLUTStorage,
    00072     StandaloneVOILUTStorage,
    00073     GrayscaleSoftcopyPresentationStateStorageSOPClass,
    00074     XRayAngiographicImageStorage,
    00075     XRayRadiofluoroscopingImageStorage,
    00076     XRayAngiographicBiPlaneImageStorageRetired,
    00077     NuclearMedicineImageStorage,
    00078     RawDataStorage,
    00079     SpacialRegistrationStorage,
    00080     SpacialFiducialsStorage,
    00081     PETImageStorage,
    00082     RTImageStorage,
    00083     RTDoseStorage,
    00084     RTStructureSetStorage,
    00085     RTPlanStorage,
    00086     CSANonImageStorage,
    00087     Philips3D,
    00088     EnhancedSR,
    00089     BasicTextSR,
    00090     HardcopyGrayscaleImageStorage,
    00091     ComprehensiveSR,
    00092     DetachedStudyManagementSOPClass,
    00093     EncapsulatedPDFStorage,
    00094     StudyComponentManagementSOPClass,
    00095     DetachedVisitManagementSOPClass,
    00096     DetachedPatientManagementSOPClass,
    00097     VideoEndoscopicImageStorage,
    00098     GeneralElectricMagneticResonanceImageStorage,
    00099     GEPrivate3DModelStorage,
    00100     ToshibaPrivateDataStorage,
    00101     MammographyCADSR,
    00102     KeyObjectSelectionDocument,
    00103     HangingProtocolStorage,
    00104     ModalityPerformedProcedureStepSOPClass,
    00105     PhilipsPrivateMRSyntheticImageStorage,
    00106     MS_END
    00107   } MSType; // Media Storage Type
    00108
    00109 typedef enum {
    00110     NoObject = 0, // DICOMDIR
    00111     Video, // Most common, include image, video and volume
    00112     Waveform, // Isn't it simply a 1D video ?
    00113     Audio, // ???
    00114     PDF,
    00115     URI, // URL...
    00116     Segmentation, // TODO
    00117     ObjectEnd
    00118   } ObjectType;
    00119
    00120   static const char* GetMSString(MSType ts);
    00121   const char* GetString() const;
    00122   static MSType GetMSType(const char *str);
    00123
    00124   MediaStorage(MSType type = MS_END):MSField(type) {}
    00125
    00128   static bool IsImage(MSType ts);
    00129
    00130   operator MSType () const { return MSField; }
    00131
    00132   const char *GetModality() const;
    00133
    00138   bool SetFromFile(File const &file);
    00139
    00142   bool SetFromDataSet(DataSet const &ds); // Will get the SOP Class UID
    00143   bool SetFromHeader(FileMetaInformation const &fmi); // Will get the Media Storage SOP Class UID
    00144   bool SetFromModality(DataSet const &ds);
    00145   void GuessFromModality(const char *modality, unsigned int dimension = 2);
    00146
    00147   friend std::ostream &operator<<(std::ostream &os, const MediaStorage &ms);
    00148
    00149   bool IsUndefined() const { return MSField == MS_END; }
    00150
    00151 protected:
    00152   void SetFromSourceImageSequence(DataSet const &ds);
    00153
    00154 private:
    00155   bool SetFromDataSetOrHeader(DataSet const &ds, const Tag & tag);
    00156   const char* GetFromDataSetOrHeader(DataSet const &ds, const Tag & tag);
    00157   const char* GetFromHeader(FileMetaInformation const &fmi);
    00158   const char* GetFromDataSet(DataSet const &ds);
    00159
    00160 private:
    00161   MSType MSField;
    00162 };
    00163 //-----------------------------------------------------------------------------
    00164 inline std::ostream &operator<<(std::ostream &_os, const MediaStorage &ms)
    00165 {
    00166   _os << MediaStorage::GetMSString(ms);
    00167   return _os;
    00168
    00169 }
    00170
    00171 } // end namespace gdcm
    00172
    00173 #endif // __gdcmMediaStorage_h