# 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-2010 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;
    00027
    00028 // WARNING: This class will be deprecated in the future. There is no reason to extend this class.
    00029 // Please check the gdcm::UIDs class if adding new well known UID.
    00030
    00042 class GDCM_EXPORT MediaStorage
    00043 {
    00044 public:
    00045   typedef enum {
    00046     MediaStorageDirectoryStorage = 0,
    00047     ComputedRadiographyImageStorage,
    00048     DigitalXRayImageStorageForPresentation,
    00049     DigitalXRayImageStorageForProcessing,
    00050     DigitalMammographyImageStorageForPresentation,
    00051     DigitalMammographyImageStorageForProcessing,
    00052     DigitalIntraoralXrayImageStorageForPresentation,
    00053     DigitalIntraoralXRayImageStorageForProcessing,
    00054     CTImageStorage,
    00055     EnhancedCTImageStorage,
    00056     UltrasoundImageStorageRetired,
    00057     UltrasoundImageStorage,
    00058     UltrasoundMultiFrameImageStorageRetired,
    00059     UltrasoundMultiFrameImageStorage,
    00060     MRImageStorage,
    00061     EnhancedMRImageStorage,
    00062     MRSpectroscopyStorage,
    00063     NuclearMedicineImageStorageRetired,
    00064     SecondaryCaptureImageStorage,
    00065     MultiframeSingleBitSecondaryCaptureImageStorage,
    00066     MultiframeGrayscaleByteSecondaryCaptureImageStorage,
    00067     MultiframeGrayscaleWordSecondaryCaptureImageStorage,
    00068     MultiframeTrueColorSecondaryCaptureImageStorage,
    00069     StandaloneOverlayStorage,
    00070     StandaloneCurveStorage,
    00071     LeadECGWaveformStorage, // 12-
    00072     GeneralECGWaveformStorage,
    00073     AmbulatoryECGWaveformStorage,
    00074     HemodynamicWaveformStorage,
    00075     CardiacElectrophysiologyWaveformStorage,
    00076     BasicVoiceAudioWaveformStorage,
    00077     StandaloneModalityLUTStorage,
    00078     StandaloneVOILUTStorage,
    00079     GrayscaleSoftcopyPresentationStateStorageSOPClass,
    00080     XRayAngiographicImageStorage,
    00081     XRayRadiofluoroscopingImageStorage,
    00082     XRayAngiographicBiPlaneImageStorageRetired,
    00083     NuclearMedicineImageStorage,
    00084     RawDataStorage,
    00085     SpacialRegistrationStorage, // Spatial
    00086     SpacialFiducialsStorage, // Spatial..
    00087     PETImageStorage,
    00088     RTImageStorage,
    00089     RTDoseStorage,
    00090     RTStructureSetStorage,
    00091     RTPlanStorage,
    00092     CSANonImageStorage,
    00093     Philips3D,
    00094     EnhancedSR,
    00095     BasicTextSR,
    00096     HardcopyGrayscaleImageStorage,
    00097     ComprehensiveSR,
    00098     DetachedStudyManagementSOPClass,
    00099     EncapsulatedPDFStorage,
    00100     StudyComponentManagementSOPClass,
    00101     DetachedVisitManagementSOPClass,
    00102     DetachedPatientManagementSOPClass,
    00103     VideoEndoscopicImageStorage,
    00104     GeneralElectricMagneticResonanceImageStorage,
    00105     GEPrivate3DModelStorage,
    00106     ToshibaPrivateDataStorage,
    00107     MammographyCADSR,
    00108     KeyObjectSelectionDocument,
    00109     HangingProtocolStorage,
    00110     ModalityPerformedProcedureStepSOPClass,
    00111     PhilipsPrivateMRSyntheticImageStorage,
    00112     VLPhotographicImageStorage,
    00113     SegmentationStorage, // "1.2.840.10008.5.1.4.1.1.66.4"
    00114     RTIonPlanStorage, // 1.2.840.10008.5.1.4.1.1.481.8
    00115     XRay3DAngiographicImageStorage, // 1.2.840.10008.5.1.4.1.1.13.1.1
    00116     EnhancedXAImageStorage,
    00117     MS_END
    00118   } MSType; // Media Storage Type
    00119
    00120 typedef enum {
    00121     NoObject = 0, // DICOMDIR
    00122     Video, // Most common, include image, video and volume
    00123     Waveform, // Isn't it simply a 1D video ?
    00124     Audio, // ???
    00125     PDF,
    00126     URI, // URL...
    00127     Segmentation, // TODO
    00128     ObjectEnd
    00129   } ObjectType;
    00130
    00132   static const char* GetMSString(MSType ts);
    00133
    00135   const char* GetString() const;
    00136   static MSType GetMSType(const char *str);
    00137
    00138   MediaStorage(MSType type = MS_END):MSField(type) {}
    00139
    00142   static bool IsImage(MSType ts);
    00143
    00144   operator MSType () const { return MSField; }
    00145
    00146   const char *GetModality() const;
    00147   unsigned int GetModalityDimension() const;
    00148
    00149   static unsigned int GetNumberOfMSType();
    00150   static unsigned int GetNumberOfMSString();
    00151   static unsigned int GetNumberOfModality();
    00152
    00153
    00158   bool SetFromFile(File const &file);
    00159
    00162   bool SetFromDataSet(DataSet const &ds); // Will get the SOP Class UID
    00163   bool SetFromHeader(FileMetaInformation const &fmi); // Will get the Media Storage SOP Class UID
    00164   bool SetFromModality(DataSet const &ds);
    00165   void GuessFromModality(const char *modality, unsigned int dimension = 2);
    00166
    00167   friend std::ostream &operator<<(std::ostream &os, const MediaStorage &ms);
    00168
    00169   bool IsUndefined() const { return MSField == MS_END; }
    00170
    00171 protected:
    00172   void SetFromSourceImageSequence(DataSet const &ds);
    00173
    00174 private:
    00175   bool SetFromDataSetOrHeader(DataSet const &ds, const Tag & tag);
    00177   const char* GetFromDataSetOrHeader(DataSet const &ds, const Tag & tag);
    00179   const char* GetFromHeader(FileMetaInformation const &fmi);
    00181   const char* GetFromDataSet(DataSet const &ds);
    00182
    00183 private:
    00184   MSType MSField;
    00185 };
    00186 //-----------------------------------------------------------------------------
    00187 inline std::ostream &operator<<(std::ostream &_os, const MediaStorage &ms)
    00188 {
    00189   const char *msstring = MediaStorage::GetMSString(ms);
    00190   _os << (msstring ? msstring : "INVALID MEDIA STORAGE");
    00191   return _os;
    00192
    00193 }
    00194
    00195 } // end namespace gdcm
    00196
    00197 #endif // GDCMMEDIASTORAGE_H