# gdcmImageHelper.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 GDCMIMAGEHELPER_H
    00016 #define GDCMIMAGEHELPER_H
    00017
    00018 #include "gdcmTypes.h"
    00019 #include "gdcmTag.h"
    00020 #include <vector>
    00021 #include "gdcmPixelFormat.h"
    00022 #include "gdcmPhotometricInterpretation.h"
    00023 #include "gdcmSmartPointer.h"
    00024 #include "gdcmLookupTable.h"
    00025
    00026 namespace gdcm
    00027 {
    00028
    00029 class MediaStorage;
    00030 class DataSet;
    00031 class File;
    00032 class Image;
    00033 class ByteValue;
    00049 class GDCM_EXPORT ImageHelper
    00050 {
    00051 public:
    00057   static void SetForceRescaleInterceptSlope(bool);
    00058   static bool GetForceRescaleInterceptSlope();
    00059
    00066   static void SetForcePixelSpacing(bool);
    00067   static bool GetForcePixelSpacing();
    00068
    00072   static std::vector<unsigned int> GetDimensionsValue(const File& f);
    00073
    00076   static PixelFormat GetPixelFormatValue(const File& f);
    00077
    00082   static std::vector<double> GetRescaleInterceptSlopeValue(File const & f);
    00083   static void SetRescaleInterceptSlopeValue(File & f, const Image & img);
    00084
    00086   static std::vector<double> GetOriginValue(File const & f);
    00087   static void SetOriginValue(DataSet & ds, const Image & img);
    00088
    00091   static std::vector<double> GetDirectionCosinesValue(File const & f);
    00097   // FIXME: There is a major issue for image with multiple IOP (eg. Enhanced * Image Storage).
    00098   static void SetDirectionCosinesValue(DataSet & ds, const std::vector<double> & dircos);
    00099
    00101   static std::vector<double> GetSpacingValue(File const & f);
    00102   static void SetSpacingValue(DataSet & ds, const std::vector<double> & spacing);
    00103
    00105   static bool ComputeSpacingFromImagePositionPatient(const std::vector<double> &imageposition, std::vector<double> & spacing);
    00106
    00107   static bool GetDirectionCosinesFromDataSet(DataSet const & ds, std::vector<double> & dircos);
    00108
    00109   //functions to get more information from a file
    00110   //useful for the stream image reader, which fills in necessary image information
    00111   //distinctly from the reader-style data input
    00112   static PhotometricInterpretation GetPhotometricInterpretationValue(File const& f);
    00113   //returns the configuration of colors in a plane, either RGB RGB RGB or RRR GGG BBB
    00114   static unsigned int GetPlanarConfigurationValue(const File& f);
    00115
    00116   //returns the lookup table of an image file
    00117   static SmartPointer<LookupTable> GetLUT(File const& f);
    00118
    00120   static const ByteValue* GetPointerFromElement(Tag const &tag, File const& f);
    00121
    00122 protected:
    00123   static Tag GetSpacingTagFromMediaStorage(MediaStorage const &ms);
    00124   static Tag GetZSpacingTagFromMediaStorage(MediaStorage const &ms);
    00125
    00126 private:
    00127   static bool ForceRescaleInterceptSlope;
    00128   static bool ForcePixelSpacing;
    00129 };
    00130
    00131 } // end namespace gdcm
    00132
    00133 #endif //__gdcmSpacing_h