GDCM
2.2.0
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 00005 Copyright (c) 2006-2011 Mathieu Malaterre 00006 All rights reserved. 00007 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notice for more information. 00012 00013 =========================================================================*/ 00014 #ifndef GDCMIMAGEHELPER_H 00015 #define GDCMIMAGEHELPER_H 00016 00017 #include "gdcmTypes.h" 00018 #include "gdcmTag.h" 00019 #include <vector> 00020 #include "gdcmPixelFormat.h" 00021 #include "gdcmPhotometricInterpretation.h" 00022 #include "gdcmSmartPointer.h" 00023 #include "gdcmLookupTable.h" 00024 00025 namespace gdcm 00026 { 00027 00028 class MediaStorage; 00029 class DataSet; 00030 class File; 00031 class Image; 00032 class ByteValue; 00048 class GDCM_EXPORT ImageHelper 00049 { 00050 public: 00056 static void SetForceRescaleInterceptSlope(bool); 00057 static bool GetForceRescaleInterceptSlope(); 00058 00065 static void SetForcePixelSpacing(bool); 00066 static bool GetForcePixelSpacing(); 00067 00071 static std::vector<unsigned int> GetDimensionsValue(const File& f); 00072 static void SetDimensionsValue(File& f, const Image & img); 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 // GDCMIMAGEHELPER_H