# 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-2009 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
    00022 namespace gdcm
    00023 {
    00024
    00025 class MediaStorage;
    00026 class DataSet;
    00027 class File;
    00028 class Image;
    00044 class GDCM_EXPORT ImageHelper
    00045 {
    00046 public:
    00052   static void SetForceRescaleInterceptSlope(bool);
    00053   static bool GetForceRescaleInterceptSlope();
    00054
    00061   static void SetForcePixelSpacing(bool);
    00062   static bool GetForcePixelSpacing();
    00063
    00065   static std::vector<double> GetRescaleInterceptSlopeValue(File const & f);
    00066   static void SetRescaleInterceptSlopeValue(File & f, const Image & img);
    00067
    00069   static std::vector<double> GetOriginValue(File const & f);
    00070   static void SetOriginValue(DataSet & ds, const Image & img);
    00071
    00073   static std::vector<double> GetDirectionCosinesValue(File const & f);
    00079   // FIXME: There is a major issue for image with multiple IOP (eg. Enhanced * Image Storage).
    00080   static void SetDirectionCosinesValue(DataSet & ds, const std::vector<double> & dircos);
    00081
    00083   static std::vector<double> GetSpacingValue(File const & f);
    00084   static void SetSpacingValue(DataSet & ds, const std::vector<double> & spacing);
    00085
    00087   static bool ComputeSpacingFromImagePositionPatient(const std::vector<double> &imageposition, std::vector<double> & spacing);
    00088
    00089   static bool GetDirectionCosinesFromDataSet(DataSet const & ds, std::vector<double> & dircos);
    00090
    00091 protected:
    00092   static Tag GetSpacingTagFromMediaStorage(MediaStorage const &ms);
    00093   static Tag GetZSpacingTagFromMediaStorage(MediaStorage const &ms);
    00094
    00095 private:
    00096   static bool ForceRescaleInterceptSlope;
    00097   static bool ForcePixelSpacing;
    00098 };
    00099
    00100 } // end namespace gdcm
    00101
    00102 #endif //__gdcmSpacing_h
    00103