GDCM
2.0.18
|
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 00075 static PixelFormat GetPixelFormatValue(const File& f); 00076 00081 static std::vector<double> GetRescaleInterceptSlopeValue(File const & f); 00082 static void SetRescaleInterceptSlopeValue(File & f, const Image & img); 00083 00085 static std::vector<double> GetOriginValue(File const & f); 00086 static void SetOriginValue(DataSet & ds, const Image & img); 00087 00090 static std::vector<double> GetDirectionCosinesValue(File const & f); 00096 // FIXME: There is a major issue for image with multiple IOP (eg. Enhanced * Image Storage). 00097 static void SetDirectionCosinesValue(DataSet & ds, const std::vector<double> & dircos); 00098 00100 static std::vector<double> GetSpacingValue(File const & f); 00101 static void SetSpacingValue(DataSet & ds, const std::vector<double> & spacing); 00102 00104 static bool ComputeSpacingFromImagePositionPatient(const std::vector<double> &imageposition, std::vector<double> & spacing); 00105 00106 static bool GetDirectionCosinesFromDataSet(DataSet const & ds, std::vector<double> & dircos); 00107 00108 //functions to get more information from a file 00109 //useful for the stream image reader, which fills in necessary image information 00110 //distinctly from the reader-style data input 00111 static PhotometricInterpretation GetPhotometricInterpretationValue(File const& f); 00112 //returns the configuration of colors in a plane, either RGB RGB RGB or RRR GGG BBB 00113 static unsigned int GetPlanarConfigurationValue(const File& f); 00114 00115 //returns the lookup table of an image file 00116 static SmartPointer<LookupTable> GetLUT(File const& f); 00117 00119 static const ByteValue* GetPointerFromElement(Tag const &tag, File const& f); 00120 00121 protected: 00122 static Tag GetSpacingTagFromMediaStorage(MediaStorage const &ms); 00123 static Tag GetZSpacingTagFromMediaStorage(MediaStorage const &ms); 00124 00125 private: 00126 static bool ForceRescaleInterceptSlope; 00127 static bool ForcePixelSpacing; 00128 }; 00129 00130 } // end namespace gdcm 00131 00132 #endif //__gdcmSpacing_h