gdcmImageHelper.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMIMAGEHELPER_H
#define GDCMIMAGEHELPER_H
#include "gdcmTypes.h"
#include "gdcmTag.h"
#include <vector>
#include "gdcmPixelFormat.h"
#include "gdcmPhotometricInterpretation.h"
#include "gdcmSmartPointer.h"
#include "gdcmLookupTable.h"
namespace gdcm
{
class MediaStorage;
class DataSet;
class File;
class Image;
class Pixmap;
class ByteValue;
// minimal struct:
struct RealWorldValueMappingContent {
double RealWorldValueIntercept;
double RealWorldValueSlope;
// http://dicom.nema.org/MEDICAL/DICOM/2014c/output/chtml/part16/sect_CID_7181.html
std::string CodeValue;
std::string CodeMeaning;
};
class GDCM_EXPORT ImageHelper
{
public:
static void SetForceRescaleInterceptSlope(bool);
static bool GetForceRescaleInterceptSlope();
static void SetPMSRescaleInterceptSlope(bool);
static bool GetPMSRescaleInterceptSlope();
static void SetForcePixelSpacing(bool);
static bool GetForcePixelSpacing();
static void SetSecondaryCaptureImagePlaneModule(bool);
static bool GetSecondaryCaptureImagePlaneModule();
static std::vector<unsigned int> GetDimensionsValue(const File& f);
static void SetDimensionsValue(File& f, const Pixmap & img);
static PixelFormat GetPixelFormatValue(const File& f);
static std::vector<double> GetRescaleInterceptSlopeValue(File const & f);
static void SetRescaleInterceptSlopeValue(File & f, const Image & img);
// read only for now
static bool GetRealWorldValueMappingContent(File const & f, RealWorldValueMappingContent & rwvmc);
static std::vector<double> GetOriginValue(File const & f);
static void SetOriginValue(DataSet & ds, const Image & img);
static std::vector<double> GetDirectionCosinesValue(File const & f);
// FIXME: There is a major issue for image with multiple IOP (eg. Enhanced * Image Storage).
static void SetDirectionCosinesValue(DataSet & ds, const std::vector<double> & dircos);
static std::vector<double> GetSpacingValue(File const & f);
static void SetSpacingValue(DataSet & ds, const std::vector<double> & spacing);
static bool ComputeSpacingFromImagePositionPatient(const std::vector<double> &imageposition, std::vector<double> & spacing);
static bool GetDirectionCosinesFromDataSet(DataSet const & ds, std::vector<double> & dircos);
//functions to get more information from a file
//useful for the stream image reader, which fills in necessary image information
//distinctly from the reader-style data input
static PhotometricInterpretation GetPhotometricInterpretationValue(File const& f);
//returns the configuration of colors in a plane, either RGB RGB RGB or RRR GGG BBB
static unsigned int GetPlanarConfigurationValue(const File& f);
static SmartPointer<LookupTable> GetLUT(File const& f);
// Moved from PixampReader to here. Generally used for photometric interpretation.
static const ByteValue* GetPointerFromElement(Tag const &tag, File const& f);
static MediaStorage ComputeMediaStorageFromModality(const char *modality,
unsigned int dimension = 2, PixelFormat const & pf = PixelFormat(),
PhotometricInterpretation const & pi = PhotometricInterpretation(),
double rescaleintercept = 0, double rescaleslope = 1 );
protected:
static Tag GetSpacingTagFromMediaStorage(MediaStorage const &ms);
static Tag GetZSpacingTagFromMediaStorage(MediaStorage const &ms);
private:
static bool ForceRescaleInterceptSlope;
static bool PMSRescaleInterceptSlope;
static bool ForcePixelSpacing;
static bool SecondaryCaptureImagePlaneModule;
};
} // end namespace gdcm
#endif // GDCMIMAGEHELPER_H
gdcm::ByteValue
Class to represent binary value (array of bytes).
Definition gdcmByteValue.h:35
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements).
Definition gdcmDataSet.h:56
gdcm::File
a DICOM File
Definition gdcmFile.h:34
gdcm::ImageHelper
ImageHelper (internal class, not intended for user level).
Definition gdcmImageHelper.h:60
gdcm::ImageHelper::GetPixelFormatValue
static PixelFormat GetPixelFormatValue(const File &f)
gdcm::ImageHelper::GetOriginValue
static std::vector< double > GetOriginValue(File const &f)
Set/Get Origin (IPP) from/to a file.
gdcm::ImageHelper::GetPMSRescaleInterceptSlope
static bool GetPMSRescaleInterceptSlope()
gdcm::ImageHelper::GetRescaleInterceptSlopeValue
static std::vector< double > GetRescaleInterceptSlopeValue(File const &f)
gdcm::ImageHelper::SetDirectionCosinesValue
static void SetDirectionCosinesValue(DataSet &ds, const std::vector< double > &dircos)
gdcm::ImageHelper::SetOriginValue
static void SetOriginValue(DataSet &ds, const Image &img)
gdcm::ImageHelper::GetDirectionCosinesFromDataSet
static bool GetDirectionCosinesFromDataSet(DataSet const &ds, std::vector< double > &dircos)
gdcm::ImageHelper::ComputeSpacingFromImagePositionPatient
static bool ComputeSpacingFromImagePositionPatient(const std::vector< double > &imageposition, std::vector< double > &spacing)
DO NOT USE.
gdcm::ImageHelper::GetSpacingTagFromMediaStorage
static Tag GetSpacingTagFromMediaStorage(MediaStorage const &ms)
gdcm::ImageHelper::GetPhotometricInterpretationValue
static PhotometricInterpretation GetPhotometricInterpretationValue(File const &f)
gdcm::ImageHelper::SetDimensionsValue
static void SetDimensionsValue(File &f, const Pixmap &img)
gdcm::ImageHelper::GetRealWorldValueMappingContent
static bool GetRealWorldValueMappingContent(File const &f, RealWorldValueMappingContent &rwvmc)
gdcm::ImageHelper::GetDimensionsValue
static std::vector< unsigned int > GetDimensionsValue(const File &f)
gdcm::ImageHelper::SetSpacingValue
static void SetSpacingValue(DataSet &ds, const std::vector< double > &spacing)
gdcm::ImageHelper::GetDirectionCosinesValue
static std::vector< double > GetDirectionCosinesValue(File const &f)
gdcm::ImageHelper::GetPlanarConfigurationValue
static unsigned int GetPlanarConfigurationValue(const File &f)
gdcm::ImageHelper::GetZSpacingTagFromMediaStorage
static Tag GetZSpacingTagFromMediaStorage(MediaStorage const &ms)
gdcm::ImageHelper::GetSecondaryCaptureImagePlaneModule
static bool GetSecondaryCaptureImagePlaneModule()
gdcm::ImageHelper::SetSecondaryCaptureImagePlaneModule
static void SetSecondaryCaptureImagePlaneModule(bool)
gdcm::ImageHelper::SetForcePixelSpacing
static void SetForcePixelSpacing(bool)
gdcm::ImageHelper::GetSpacingValue
static std::vector< double > GetSpacingValue(File const &f)
Set/Get Spacing from/to a File.
gdcm::ImageHelper::GetPointerFromElement
static const ByteValue * GetPointerFromElement(Tag const &tag, File const &f)
gdcm::ImageHelper::GetLUT
static SmartPointer< LookupTable > GetLUT(File const &f)
returns the lookup table of an image file
gdcm::ImageHelper::ComputeMediaStorageFromModality
static MediaStorage ComputeMediaStorageFromModality(const char *modality, unsigned int dimension=2, PixelFormat const &pf=PixelFormat(), PhotometricInterpretation const &pi=PhotometricInterpretation(), double rescaleintercept=0, double rescaleslope=1)
Moved from MediaStorage here, since we need extra info stored in PixelFormat & PhotometricInterpretat...
gdcm::ImageHelper::SetForceRescaleInterceptSlope
static void SetForceRescaleInterceptSlope(bool)
gdcm::ImageHelper::SetPMSRescaleInterceptSlope
static void SetPMSRescaleInterceptSlope(bool)
gdcm::ImageHelper::GetForceRescaleInterceptSlope
static bool GetForceRescaleInterceptSlope()
gdcm::ImageHelper::GetForcePixelSpacing
static bool GetForcePixelSpacing()
gdcm::ImageHelper::SetRescaleInterceptSlopeValue
static void SetRescaleInterceptSlopeValue(File &f, const Image &img)
gdcm::Image
Image.
Definition gdcmImage.h:47
gdcm::MediaStorage
MediaStorage.
Definition gdcmMediaStorage.h:44
gdcm::PhotometricInterpretation
Class to represent an PhotometricInterpretation.
Definition gdcmPhotometricInterpretation.h:29
gdcm::PixelFormat
PixelFormat.
Definition gdcmPixelFormat.h:46
gdcm::Pixmap
Pixmap class.
Definition gdcmPixmap.h:33
gdcm::SmartPointer
Class for Smart Pointer.
Definition gdcmSmartPointer.h:40
gdcm::Tag
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
gdcmLookupTable.h
gdcmPhotometricInterpretation.h
gdcmPixelFormat.h
gdcmSmartPointer.h
gdcmTag.h
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::RealWorldValueMappingContent
Definition gdcmImageHelper.h:36
gdcm::RealWorldValueMappingContent::RealWorldValueSlope
double RealWorldValueSlope
Definition gdcmImageHelper.h:38
gdcm::RealWorldValueMappingContent::RealWorldValueIntercept
double RealWorldValueIntercept
Definition gdcmImageHelper.h:37
gdcm::RealWorldValueMappingContent::CodeValue
std::string CodeValue
Definition gdcmImageHelper.h:40
gdcm::RealWorldValueMappingContent::CodeMeaning
std::string CodeMeaning
Definition gdcmImageHelper.h:41