gdcmFile.h

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmFile.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/08/22 16:14:04 $
00007   Version:   $Revision: 1.133 $
00008                                                                                 
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012                                                                                 
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
00016                                                                                 
00017 =========================================================================*/
00018 
00019 #ifndef _GDCMFILE_H_
00020 #define _GDCMFILE_H_
00021 
00022 #include "gdcmDebug.h"
00023 #include "gdcmDocument.h"
00024 #include "gdcmTagKey.h"
00025 
00026 
00027 namespace GDCM_NAME_SPACE 
00028 {
00029 
00030 class RLEFramesInfo;
00031 class JPEGFragmentsInfo;
00032 
00033 //-----------------------------------------------------------------------------
00034 // Dicom Part 3.3 Compliant
00035 enum ModalityType {
00036    Unknow,
00037    AU,       // Voice Audio
00038    AS,       // Angioscopy
00039    BI,       // Biomagnetic Imaging
00040    CF,       // Cinefluorography
00041    CP,       // Culposcopy
00042    CR,       // Computed Radiography
00043    CS,       // Cystoscopy
00044    CT,       // Computed Tomography
00045    DD,       // Duplex Dopler
00046    DF,       // Digital Fluoroscopy
00047    DG,       // Diaphanography
00048    DM,       // Digital Microscopy
00049    DS,       // Digital Substraction Angiography
00050    DX,       // Digital Radiography
00051    ECG,      // Echocardiography
00052    EPS,      // Basic Cardiac EP
00053    ES,       // Endoscopy
00054    FA,       // Fluorescein Angiography
00055    FS,       // Fundoscopy
00056    HC,       // Hard Copy
00057    HD,       // Hemodynamic
00058    LP,       // Laparoscopy
00059    LS,       // Laser Surface Scan
00060    MA,       // Magnetic Resonance Angiography
00061    MR,       // Magnetic Resonance
00062    NM,       // Nuclear Medicine
00063    OT,       // Other
00064    PT,       // Positron Emission Tomography
00065    RF,       // Radio Fluoroscopy
00066    RG,       // Radiographic Imaging
00067    RTDOSE,   // Radiotherapy Dose
00068    RTIMAGE,  // Radiotherapy Image
00069    RTPLAN,   // Radiotherapy Plan
00070    RTSTRUCT, // Radiotherapy Structure Set
00071    SM,       // Microscopic Imaging
00072    ST,       // Single-photon Emission Computed Tomography
00073    TG,       // Thermography
00074    US,       // Ultrasound
00075    VF,       // Videofluorography
00076    XA,       // X-Ray Angiography
00077    XC        // Photographic Imaging
00078 };
00079 
00080 //-----------------------------------------------------------------------------
00081 
00099 class GDCM_EXPORT File : public Document
00100 {
00101    gdcmTypeMacro(File);
00102 
00103 public:
00104    static File *New() {return new File();}
00105 
00106    // Loading
00107   // GDCM_LEGACY(bool Load( std::string const &filename ))
00108    bool Load();
00109    // Standard values and informations contained in the header
00110    bool IsReadable();
00111 
00112    void SetFourthDimensionLocation(uint16_t group, uint16_t elem) {
00113                    FourthDimensionLocation = TagKey(group, elem); }
00114 
00115    // Some heuristic based accessors, end user intended
00116    int GetImageNumber();
00117    ModalityType GetModality();
00118 
00119    int GetXSize();
00120    int GetYSize();
00121    int GetZSize();
00122    int GetTSize(); // unnormalized in DICOM V3
00123 
00124    bool GetSpacing(float &xspacing, float &yspacing, float &zspacing);
00125    float GetXSpacing();
00126    float GetYSpacing();
00127    float GetZSpacing();
00128 
00129    float GetXOrigin();
00130    float GetYOrigin();
00131    float GetZOrigin();
00132 
00133    float GetXCosineOnX();
00134    float GetXCosineOnY();  
00135    float GetXCosineOnZ();
00136    float GetYCosineOnX();
00137    float GetYCosineOnY();  
00138    float GetYCosineOnZ();   
00139      
00140    bool GetImageOrientationPatient( float iop[6] );
00141    bool GetImagePositionPatient( float ipp[3] );
00142    
00143    int GetBitsStored();
00144    int GetBitsAllocated();
00145    int GetHighBitPosition();
00146    int GetSamplesPerPixel();
00147    int GetPlanarConfiguration();
00148    int GetPixelSize();
00149    std::string GetPixelType();
00150    bool IsSignedPixelData();
00151    bool IsMonochrome();
00152    bool IsMonochrome1();
00153    bool IsPaletteColor();
00154    bool IsYBRFull();
00155 
00156    bool HasLUT();
00157    int GetLUTNbits();
00158 
00159    // For rescaling graylevel:
00160    bool GetRescaleSlopeIntercept(double &slope, double &intercept);   
00161    double GetRescaleIntercept();
00162    double GetRescaleSlope();
00163 
00164    int GetNumberOfScalarComponents();
00165    int GetNumberOfScalarComponentsRaw();
00166 
00168    uint16_t GetGrPixel()  { return GrPixel; }
00170    uint16_t GetNumPixel() { return NumPixel; }
00171 
00172    size_t GetPixelOffset();
00173    size_t GetPixelAreaLength();
00174 
00176    RLEFramesInfo *GetRLEInfo() { return RLEInfo; }
00178    JPEGFragmentsInfo *GetJPEGInfo() { return JPEGInfo; }
00179 
00180 // Anonymization process
00181    void AddAnonymizeElement (uint16_t group, uint16_t elem, 
00182                              std::string const &value);
00184    void ClearAnonymizeList() { UserAnonymizeList.clear(); }      
00185    void AnonymizeNoLoad();
00187    bool AnonymizeFile();
00188 
00189    bool Write(std::string fileName, FileType filetype);
00190 
00191 protected:
00192    File();
00193    virtual ~File();
00195    bool MayIWrite(uint16_t group)
00196      { if (group < 8 &&  group !=2 ) return false; else return true; }
00197       
00199    RLEFramesInfo *RLEInfo;
00201    JPEGFragmentsInfo *JPEGInfo;
00202 
00207    uint16_t NumPixel;
00212    uint16_t GrPixel;
00215    TagKey FourthDimensionLocation;
00216 
00217 private:
00218    bool DoTheLoadingJob();
00219    void ComputeRLEInfo();
00220    void ComputeJPEGFragmentInfo();
00221    bool     ReadTag(uint16_t, uint16_t);
00222    uint32_t ReadTagLength(uint16_t, uint16_t);
00223    void ReadEncapsulatedBasicOffsetTable();
00224    uint32_t *BasicOffsetTableItemValue;
00225 
00226 };
00227 } // end namespace gdcm
00228 
00229 //-----------------------------------------------------------------------------
00230 #endif

Generated on Fri Aug 24 12:53:16 2007 for gdcm by  doxygen 1.4.6