fw4spl
fwData::Image Class Reference

This class defines an image. More...

#include <Image.hpp>

+ Inheritance diagram for fwData::Image:
+ Collaboration diagram for fwData::Image:

Public Types

typedef ::fwData::Array::SizeType SizeType
 Image size type.
 
typedef std::vector< double > SpacingType
 Image spacing type.
 
typedef std::vector< double > OriginType
 Image origin type.
 
typedef SizeType::value_type IndexType
 
typedef size_t BufferIndexType
 
typedef std::uint8_t BufferType
 
typedef ::boost::shared_array< BufferType > SharedArray
 
- Public Types inherited from fwData::Object
typedef ::fwData::factory::Key Key
 
typedef std::string FieldNameType
 
typedef std::vector< FieldNameType > FieldNameVectorType
 
typedef ::std::unordered_map< FieldNameType,::fwData::Object::sptr > FieldMapType
 
typedef ::std::unordered_map< ::fwData::Object::csptr,::fwData::Object::sptr > DeepCopyCacheType
 
typedef ::fwCom::Signal< void() > ModifiedSignalType
 Type of signal m_sigModified.
 
typedef std::map< std::string,::fwData::Object::sptr > FieldsContainerType
 Type of signal m_sigModified.
 
typedef ::fwCom::Signal< void(FieldsContainerType) > AddedFieldsSignalType
 Type of signal when objects are added.
 
typedef ::fwCom::Signal< void(FieldsContainerType, FieldsContainerType) > ChangedFieldsSignalType
 Type of signal when objects are changed (newObjects, oldObjects)
 
typedef ::fwCom::Signal< void(FieldsContainerType) > RemovedFieldsSignalType
 Type of signal when objects are removed.
 
- Public Types inherited from fwCom::HasSignals
typedef std::shared_ptr< HasSignalssptr
 
typedef std::shared_ptr< const HasSignalscsptr
 

Public Member Functions

virtual bool isA (const std::string &type) const override
 
FWDATA_API Image (::fwData::Object::Key key)
 Constructor. More...
 
virtual FWDATA_API ~Image () noexcept
 Destructor.
 
FWDATA_API void shallowCopy (const Object::csptr &_source) override
 Defines shallow copy.
 
FWDATA_API void cachedDeepCopy (const Object::csptr &_source, DeepCopyCacheType &cache) override
 Defines deep copy.
 
FWDATA_API void copyInformation (Image::csptr _source)
 get image information from source. Informations are spacing,origin,size ... expect Fields
 
FWDATA_API size_t getNumberOfDimensions () const
 Number of dimension of the image (3 for 3D image)
 
FWDATA_API void setDataArray (::fwData::Array::sptr array, bool copyArrayInfo=true)
 set data array More...
 
FWDATA_API::fwData::Array::sptr getDataArray () const
 get data array
 
FWDATA_API::fwTools::DynamicType getPixelType () const
 get a DynamicType for retrocompatibility
 
FWDATA_API size_t getSizeInBytes () const
 return image size in bytes
 
FWDATA_API size_t getAllocatedSizeInBytes () const
 return allocated image size in bytes
 
FWDATA_API const SpacingTypegetSpacing () const
 get/set image spacing
 
FWDATA_API void setSpacing (const SpacingType &spacing)
 get/set image spacing
 
FWDATA_API const OriginTypegetOrigin () const
 get/set image origin
 
FWDATA_API void setOrigin (const OriginType &origin)
 get/set image origin
 
FWDATA_API const SizeTypegetSize () const
 get/set image size
 
FWDATA_API void setSize (const SizeType &size)
 get/set image size
 
double getWindowCenter () const
 Get/set preferred window center.
 
void setWindowCenter (double val)
 Get/set preferred window center.
 
double getWindowWidth () const
 Get/set preferred window width.
 
void setWindowWidth (double val)
 Get/set preferred window width.
 
size_t getNumberOfComponents () const
 Get/set preferred window center.
 
void setNumberOfComponents (size_t val)
 Get/set preferred window center.
 
FWDATA_API void setType (::fwTools::Type type)
 get/set image type
 
FWDATA_API void setType (const std::string &type)
 get/set image type
 
FWDATA_API::fwTools::Type getType () const
 get/set image type
 
FWDATA_API size_t allocate ()
 Allocate image. More...
 
FWDATA_API size_t allocate (SizeType::value_type x, SizeType::value_type y, SizeType::value_type z, const ::fwTools::Type &type, size_t numberOfComponents=1)
 Allocate image. More...
 
FWDATA_API size_t allocate (const SizeType &size, const ::fwTools::Type &type, size_t numberOfComponents=1)
 Allocate image. More...
 
- Public Member Functions inherited from fwData::Object
FWDATA_API::fwData::Object::sptr getField (const FieldNameType &name,::fwData::Object::sptr defaultValue=::fwData::Object::sptr()) const
 Returns a pointer of corresponding field (null if non exist). More...
 
template<typename DATA_TYPE >
std::shared_ptr< DATA_TYPE > getField (const FieldNameType &name) const
 Returns a pointer of corresponding field. More...
 
template<typename DATA_TYPE >
std::shared_ptr< DATA_TYPE > getField (const FieldNameType &name, std::shared_ptr< DATA_TYPE > defaultValue) const
 Returns a pointer of corresponding field. More...
 
template<typename DATA_TYPE >
std::shared_ptr< DATA_TYPE > setDefaultField (const FieldNameType &name, std::shared_ptr< DATA_TYPE > defaultValue)
 Returns a pointer of corresponding field. If field did not exist, it is set to defaultValue if defaultValue is not null. More...
 
FWDATA_API::fwData::Object::csptr getConstField (const FieldNameType &name) const
 Returns a pointer of corresponding field (null if non exist). More...
 
FWDATA_API const FieldMapType & getFields () const
 Returns fields map.
 
FWDATA_API FieldNameVectorType getFieldNames () const
 Returns vector of field names.
 
FWDATA_API void setField (const FieldNameType &name,::fwData::Object::sptr obj)
 Register field with specified name. If the name does already exist, the matching field will be replaced. More...
 
FWDATA_API void setFields (const FieldMapType &fieldMap)
 Replace the field map content.
 
FWDATA_API void removeField (const FieldNameType &name)
 Removes field with specified name. More...
 
virtual FWDATA_API void shallowCopy (const ::fwData::Object::csptr &source)
 A shallow copy of fields (objects in m_children) More...
 
FWDATA_API void deepCopy (const ::fwData::Object::csptr &source)
 Make a deep copy from the source Calling this method may invalidate any DumpLock, RescursiveLock or helper on the object. Prefer using fwData::Object::copy instead.
 
FWDATA_API void fieldShallowCopy (const ::fwData::Object::csptr &source)
 A shallow copy of fields (objects in m_children) More...
 
FWDATA_API void fieldDeepCopy (const ::fwData::Object::csptr &source)
 A deep copy of fields (objects in m_children) More...
 
::fwCore::mt::ReadWriteMutexgetMutex () const
 Returns the object's mutex.
 
- Public Member Functions inherited from fwTools::Object
- Public Member Functions inherited from fwCore::BaseObject
- Public Member Functions inherited from fwCom::HasSignals
std::shared_ptr< SignalBasesignal (const Signals::SignalKeyType &key) const
 
template<typename SignalType >
std::shared_ptr< SignalType > signal (const Signals::SignalKeyType &key) const
 
template<typename SignalType >
std::shared_ptr< SignalType > newSignal (const Signals::SignalKeyType &key)
 

Static Public Member Functions

static bool isTypeOf (const std::string &type)
 
- Static Public Member Functions inherited from fwData::Object
static bool isTypeOf (const std::string &type)
 
static FWDATA_API::fwData::Object::sptr copy (const ::fwData::Object::csptr &source)
 return a copy of the source. if source is a null pointer, return a null pointer.
 
template<typename DATA_TYPE >
static std::shared_ptr< DATA_TYPE > copy (const std::shared_ptr< const DATA_TYPE > &source)
 return a copy of the source. if source is a null pointer, return a null pointer.
 
template<typename DATA_TYPE >
static std::shared_ptr< DATA_TYPE > copy (const std::shared_ptr< DATA_TYPE > &source)
 return a copy of the source. if source is a null pointer, return a null pointer.
 
static const std::string & classname ()
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
- Static Public Member Functions inherited from fwTools::Object
static bool isTypeOf (const std::string &type)
 
static const std::string & classname ()
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
- Static Public Member Functions inherited from fwCore::BaseObject
static bool isTypeOf (const std::string &type)
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Protected Attributes

SizeType m_size
 Size of the image (in terms of points)
 
::fwTools::Type m_type
 type of image pixel
 
SpacingType m_spacing
 An array on the voxel size of the image.
 
OriginType m_origin
 Origin of the image in 3D repair.
 
size_t m_numberOfComponents
 Number of components.
 
::fwData::Array::sptr m_dataArray
 image buffer
 
double m_windowCenter
 
double m_windowWidth
 
- Protected Attributes inherited from fwData::Object
FieldMapType m_fields
 Fields.
 
mutable::fwCore::mt::ReadWriteMutex m_mutex
 Mutex to protect object access.
 
- Protected Attributes inherited from fwTools::Object
std::shared_ptr< ::fwTools::UUIDm_uuid
 UUID used to identify the object, notably for serialization.
 
- Protected Attributes inherited from fwCom::HasSignals
Signals m_signals
 

Friends

template<class , class , class >
class ::fwTools::ClassFactory
 
class ::fwTools::Factory
 

Demangling methods

virtual const std::string & getLeafClassname () const override
 return object's classname without its namespace, i.e. BaseObject
 
virtual const std::string & getClassname () const override
 return full object's classname with its namespace, i.e. fwCore::BaseObject
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Signals

typedef ::fwCom::Signal< void() > BufferModifiedSignalType
 Type of signal when image's buffer is added.
 
typedef ::fwCom::Signal< void(std::shared_ptr< ::fwData::Point >) > LandmarkAddedSignalType
 Type of signal when a landmark is added.
 
typedef ::fwCom::Signal< void(std::shared_ptr< ::fwData::Point >) > LandmarkRemovedSignalType
 Type of signal when a landmark is removed.
 
typedef ::fwCom::Signal< void(bool) > LandmarkDisplayedSignalType
 Type of signal when a distance is added.
 
typedef ::fwCom::Signal< void(bool) > DistanceDisplayedSignalType
 Type of signal when a distance is added.
 
typedef ::fwCom::Signal< void(std::shared_ptr< ::fwData::PointList >) > DistanceAddedSignalType
 Type of signal when a distance is added.
 
typedef ::fwCom::Signal< void(std::shared_ptr< const ::fwData::PointList >) > DistanceRemovedSignalType
 Type of signal when a distance is removed.
 
typedef ::fwCom::Signal< void(int, int, int) > SliceIndexModifiedSignalType
 Type of signal when slice index is modified (axial index, frontal index, sagittal index)
 
typedef ::fwCom::Signal< void(int, int) > SliceTypeModifiedSignalType
 Type of signal when slice type is modified (from slice type, to slice type)
 
typedef ::fwCom::Signal< void(bool) > VisibilityModifiedSignalType
 Type of signal when visibility is modified.
 
typedef ::fwCom::Signal< void() > TransparencyModifiedSignalType
 Type of signal when visibility is modified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_BUFFER_MODIFIED_SIG = "bufferModified"
 Type of signal when image's buffer is added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_LANDMARK_ADDED_SIG = "landmarkAdded"
 Type of signal when image's buffer is added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_LANDMARK_REMOVED_SIG = "landmarkRemoved"
 Type of signal when image's buffer is added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_LANDMARK_DISPLAYED_SIG = "landmarkDisplayed"
 Type of signal when image's buffer is added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_DISTANCE_DISPLAYED_SIG = "distanceDisplayed"
 Type of signal when image's buffer is added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_DISTANCE_ADDED_SIG = "distanceAdded"
 Type of signal when image's buffer is added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_DISTANCE_REMOVED_SIG = "distanceRemoved"
 Type of signal when image's buffer is added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_SLICE_INDEX_MODIFIED_SIG = "sliceIndexModified"
 Type of signal when image's buffer is added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_SLICE_TYPE_MODIFIED_SIG = "sliceTypeModified"
 Type of signal when image's buffer is added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_VISIBILITY_MODIFIED_SIG = "visibilityModified"
 Type of signal when image's buffer is added.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_TRANSPARENCY_MODIFIED_SIG = "transparencyModified"
 Type of signal when image's buffer is added.
 

Additional Inherited Members

- Static Public Attributes inherited from fwData::Object
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG = "modified"
 Key in m_signals map of signal m_sigModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_ADDED_FIELDS_SIG = "addedFields"
 Type of signal m_sigModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_CHANGED_FIELDS_SIG = "changedFields"
 Type of signal m_sigModified.
 
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_REMOVED_FIELDS_SIG = "removedFields"
 Type of signal m_sigModified.
 
- Protected Types inherited from fwTools::fwID
enum  Policy { EMPTY = 1, GENERATE, MUST_EXIST }
 
typedef std::string IDType
 
- Protected Member Functions inherited from fwData::Object
FWDATA_API void fieldDeepCopy (const ::fwData::Object::csptr &source, DeepCopyCacheType &cache)
 Internal-use methods to implement Object's deepCopy.
 
virtual FWDATA_API void cachedDeepCopy (const ::fwData::Object::csptr &source, DeepCopyCacheType &cache)=0
 Internal-use methods to implement Object's deepCopy.
 
- Protected Member Functions inherited from fwTools::fwID
FWTOOLS_API bool hasID () const
 Return true if the object has an id set. More...
 
FWTOOLS_API IDType getID (Policy policy=GENERATE) const
 Returns the id of the object. If it is not set and the policy value is. More...
 
virtual FWTOOLS_API void setID (IDType newID)
 Set a newID for the object, (newID must not exist in fwID), the oldest one is released. More...
 
FWTOOLS_API void resetID ()
 Release the id for the object. More...
 
 fwID ()
 Constructor : does nothing.
 
- Protected Member Functions inherited from fwCom::HasSignals
 HasSignals (const HasSignals &)
 Copy constructor forbidden.
 
HasSignalsoperator= (const HasSignals &)
 Copy operator forbidden.
 
- Static Protected Member Functions inherited from fwData::Object
static FWDATA_API::fwData::Object::sptr copy (const ::fwData::Object::csptr &source, DeepCopyCacheType &cache)
 Internal-use methods to implement Object's deepCopy.
 
template<typename DATA_TYPE >
static std::shared_ptr< DATA_TYPE > copy (const std::shared_ptr< const DATA_TYPE > &source, DeepCopyCacheType &cache)
 Internal-use methods to implement Object's deepCopy.
 
template<typename DATA_TYPE >
static std::shared_ptr< DATA_TYPE > copy (const std::shared_ptr< DATA_TYPE > &source, DeepCopyCacheType &cache)
 Internal-use methods to implement Object's deepCopy.
 
- Static Protected Member Functions inherited from fwTools::fwID
static bool isTypeOf (const std::string &type)
 
static FWTOOLS_API bool exist (IDType _id)
 
static FWTOOLS_API std::shared_ptr< ::fwTools::ObjectgetObject (IDType requestID)
 Retrieve the object attached to the given id. Return a null sptr if no correspondence exist. More...
 
static const std::string & leafClassname ()
 return object's classname without its namespace, i.e. BaseObject
 
static const std::string & classname ()
 return object's classname without its namespace, i.e. BaseObject
 

Detailed Description

This class defines an image.

An image contains a buffer and is defined by some parameters (size, spacing, pixel type, ...)

Definition at line 38 of file core/fwData/include/fwData/Image.hpp.

Constructor & Destructor Documentation

Member Function Documentation

size_t fwData::Image::allocate ( )

Allocate image.

If the data array owns its buffer, these methods will always work (until it remain free memory) Otherwise an exception is thrown :

  • if m_dataArray does not own it buffer and image's size and type combination do not match anymore array's one
  • if there is no memory left
Returns
Allocated size in bytes

Definition at line 131 of file core/fwData/src/fwData/Image.cpp.

References m_dataArray, m_numberOfComponents, m_size, m_type, and SLM_ASSERT.

Referenced by allocate().

+ Here is the caller graph for this function:

size_t fwData::Image::allocate ( SizeType::value_type  x,
SizeType::value_type  y,
SizeType::value_type  z,
const ::fwTools::Type type,
size_t  numberOfComponents = 1 
)

Allocate image.

If the data array owns its buffer, these methods will always work (until it remain free memory) Otherwise an exception is thrown :

  • if m_dataArray does not own it buffer and image's size and type combination do not match anymore array's one
  • if there is no memory left
Returns
Allocated size in bytes

Definition at line 144 of file core/fwData/src/fwData/Image.cpp.

References allocate(), m_numberOfComponents, m_size, and m_type.

+ Here is the call graph for this function:

size_t fwData::Image::allocate ( const SizeType size,
const ::fwTools::Type type,
size_t  numberOfComponents = 1 
)

Allocate image.

If the data array owns its buffer, these methods will always work (until it remain free memory) Otherwise an exception is thrown :

  • if m_dataArray does not own it buffer and image's size and type combination do not match anymore array's one
  • if there is no memory left
Returns
Allocated size in bytes

Definition at line 155 of file core/fwData/src/fwData/Image.cpp.

References allocate(), m_numberOfComponents, m_size, and m_type.

+ Here is the call graph for this function:

void fwData::Image::setDataArray ( ::fwData::Array::sptr  array,
bool  copyArrayInfo = true 
)

set data array

Parameters
[in]arraydata array
[in]copyArrayInfoif true, the image will copy the size and type information from the array

Definition at line 115 of file core/fwData/src/fwData/Image.cpp.

References m_dataArray, m_size, and m_type.

Member Data Documentation

double fwData::Image::m_windowCenter
protected

Preferred window center/with

Definition at line 245 of file core/fwData/include/fwData/Image.hpp.

Referenced by copyInformation().

double fwData::Image::m_windowWidth
protected

Preferred window center/with

Definition at line 246 of file core/fwData/include/fwData/Image.hpp.

Referenced by copyInformation().


The documentation for this class was generated from the following files: