7 #include "fwData/Image.hpp" 9 #include "fwData/Exception.hpp" 10 #include "fwData/registry/macros.hpp" 12 #include <fwCom/Signal.hxx> 14 #include <fwTools/DynamicType.hpp> 15 #include <fwTools/DynamicTypeKeyTypeMapping.hpp> 17 #include <boost/assign.hpp> 48 m_numberOfComponents(1),
75 Image::csptr other = Image::dynamicConstCast(_source);
77 "Unable to copy" + (_source ? _source->getClassname() : std::string(
"<NULL>"))
91 Image::csptr other = Image::dynamicConstCast(_source);
93 "Unable to copy" + (_source ? _source->getClassname() : std::string(
"<NULL>"))
100 if( other->m_dataArray )
119 array = ::fwData::Array::New();
124 m_size = array->getSize();
125 m_type = array->getType();
144 size_t Image::allocate(SizeType::value_type
x, SizeType::value_type y, SizeType::value_type z,
145 const ::fwTools::Type& type,
size_t numberOfComponents)
167 typedef std::map<std::string, ::fwTools::DynamicType> DynamicTypeMapType;
169 static DynamicTypeMapType dynamicTypeMap = ::boost::assign::map_list_of
171 (
"uint8", ::fwTools::makeDynamicType<std::string>(
"unsigned char") )
173 ::fwTools::makeDynamicType<std::string>(
"unsigned short") )
175 ::fwTools::makeDynamicType<std::string>(
"unsigned int") )
176 (
"int8", ::fwTools::makeDynamicType<std::string>(
"signed char") )
178 ::fwTools::makeDynamicType<std::string>(
"signed short") )
180 ::fwTools::makeDynamicType<std::string>(
"signed int") )
182 ::fwTools::makeDynamicType<std::string>(
"float") )
184 ::fwTools::makeDynamicType<std::string>(
"double") )
187 #if ( INT_MAX < LONG_MAX ) 188 (
"uint64", ::fwTools::makeDynamicType<std::string>(
"unsigned long") )
190 ::fwTools::makeDynamicType<std::string>(
"signed long") )
192 (
"uint32", ::fwTools::makeDynamicType<std::string>(
"unsigned long") )
194 ::fwTools::makeDynamicType<std::string>(
"signed long") )
293 size_t size = std::accumulate(
296 std::multiplies< size_t > () );
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_SLICE_INDEX_MODIFIED_SIG
Type of signal when image's buffer is added.
FWDATA_API void setSize(const SizeType &size)
get/set image size
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_TRANSPARENCY_MODIFIED_SIG
Type of signal when image's buffer is added.
FWDATA_API const SpacingType & getSpacing() const
get/set image spacing
#define SLM_TRACE_FUNC()
Trace contextual function signature.
SizeType m_size
Size of the image (in terms of points)
FWDATA_API void setDataArray(::fwData::Array::sptr array, bool copyArrayInfo=true)
set data array
FWDATA_API const OriginType & getOrigin() const
get/set image origin
FWDATA_API const SizeType & getSize() const
get/set image size
virtual FWDATA_API ~Image() noexcept
Destructor.
Key class used to restrict access to Object construction. See http://www.drdobbs.com/184402053.
Implements data exception class.
size_t m_numberOfComponents
Number of components.
::fwData::Array::sptr m_dataArray
image buffer
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_LANDMARK_DISPLAYED_SIG
Type of signal when image's buffer is added.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_LANDMARK_ADDED_SIG
Type of signal when image's buffer is added.
FWDATA_API::fwData::Array::sptr getDataArray() const
get data array
FWDATA_API size_t allocate()
Allocate image.
FWDATA_API size_t getSizeInBytes() const
return image size in bytes
FWDATA_API::fwTools::Type getType() const
get/set image type
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_DISTANCE_ADDED_SIG
Type of signal when image's buffer is added.
Provides a way to manage a view on a multidimentionnal array.
FWDATA_API Image(::fwData::Object::Key key)
Constructor.
FWDATA_API void shallowCopy(const Object::csptr &_source) override
Defines shallow copy.
OriginType m_origin
Origin of the image in 3D repair.
FWDATA_API void fieldDeepCopy(const ::fwData::Object::csptr &source)
A deep copy of fields (objects in m_children)
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_VISIBILITY_MODIFIED_SIG
Type of signal when image's buffer is added.
FWDATA_API size_t getNumberOfDimensions() const
Number of dimension of the image (3 for 3D image)
FWDATA_API size_t getAllocatedSizeInBytes() const
return allocated image size in bytes
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
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.
FWDATA_API void setOrigin(const OriginType &origin)
get/set image origin
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_BUFFER_MODIFIED_SIG
Type of signal when image's buffer is added.
::fwTools::Type m_type
type of image pixel
std::vector< double > SpacingType
Image spacing type.
Contains the representation of the data objects used in the framework.
FWDATA_API void fieldShallowCopy(const ::fwData::Object::csptr &source)
A shallow copy of fields (objects in m_children)
This class defines an image.
FWDATA_API::fwTools::DynamicType getPixelType() const
get a DynamicType for retrocompatibility
FWDATA_API void copyInformation(Image::csptr _source)
get image information from source. Informations are spacing,origin,size ... expect Fields ...
SpacingType m_spacing
An array on the voxel size of the image.
virtual const std::string & getClassname() const override
return full object's classname with its namespace, i.e. fwCore::BaseObject
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_SLICE_TYPE_MODIFIED_SIG
Type of signal when image's buffer is added.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_DISTANCE_REMOVED_SIG
Type of signal when image's buffer is added.
FWDATA_API void setSpacing(const SpacingType &spacing)
get/set image spacing
::fwData::Array::SizeType SizeType
Image size type.
FWDATA_API void setType(::fwTools::Type type)
get/set image type
FWDATA_API void cachedDeepCopy(const Object::csptr &_source, DeepCopyCacheType &cache) override
Defines deep copy.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_LANDMARK_REMOVED_SIG
Type of signal when image's buffer is added.
std::vector< double > OriginType
Image origin type.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_DISTANCE_DISPLAYED_SIG
Type of signal when image's buffer is added.