fw4spl
fwDataTools::helper::MedicalImageAdaptor Class Reference

Helpers for medical image. More...

#include <MedicalImageAdaptor.hpp>

+ Inheritance diagram for fwDataTools::helper::MedicalImageAdaptor:

Public Types

enum  Orientation { X_AXIS = 0, Y_AXIS, Z_AXIS }
 Image orientation.
 

Public Member Functions

virtual bool isA (const std::string &type) const
 
virtual FWDATATOOLS_API ~MedicalImageAdaptor ()
 Destructor. Do nothing.
 
virtual FWDATATOOLS_API void setOrientation (Orientation orientation)
 Set the image orientation.
 
Orientation getOrientation () const
 Return the image orientation.
 
FWDATATOOLS_API void setTransferFunction (const ::fwData::TransferFunction::sptr &tf)
 Set the current TransferFunction.
 

Static Public Member Functions

static bool isTypeOf (const std::string &type)
 

Protected Member Functions

FWDATATOOLS_API MedicalImageAdaptor ()
 Constructor. Do nothing.
 
FWDATATOOLS_API void setOrientation (int orientation)
 Set the orientation of the image. More...
 
FWDATATOOLS_API void getImageSpacing (double spacing[3]) const
 Get the image spacing. More...
 
FWDATATOOLS_API void getImageOrigin (double origin[3]) const
 Get the image origin. More...
 
FWDATATOOLS_API void getImageDataSize (int size[3]) const
 Get the image data size (number of slices). More...
 
FWDATATOOLS_API void getImageSize (double size[3]) const
 Get the image size ( = dataSize * spacing ). More...
 
FWDATATOOLS_API void getCurrentSliceCenter (double center[3])
 Get the slice center. More...
 
FWDATATOOLS_API void worldToSliceIndex (const double world[3], int index[3])
 Convert world coordinates to slice index coordinates. More...
 
FWDATATOOLS_API void worldToImageSliceIndex (const double world[3], int index[3])
 Convert coordinates in the world to coordinates in the image. More...
 
FWDATATOOLS_API void sliceIndexToWorld (const int index[3], double world[3])
 Convert from world coordinates system to image coordinates system. More...
 
FWDATATOOLS_API::fwData::Image::sptr getImage () const
 Return the image.
 
template<typename FLOAT_ARRAY_3 >
void getImageSpacing (FLOAT_ARRAY_3 spacing)
 Get the image spacing. More...
 
template<typename INT_INDEX >
void getImageDataSize (INT_INDEX size)
 Get the image data size (number of slices). More...
 
template<typename WORLD , typename INT_INDEX >
void worldToSliceIndex (const WORLD world, INT_INDEX *index)
 Convert world coordinates to slice index coordinates. More...
 
template<typename WORLD , typename INT_INDEX >
void worldToImageSliceIndex (const WORLD world, INT_INDEX *index)
 Convert coordinates in the world to coordinates in the image. More...
 
FWDATATOOLS_API void getPlane (double points[4][3], int sliceNumber)
 Return the 4 points of the image plane. More...
 
FWDATATOOLS_API bool setSliceIndex (const int index[3])
 Set the slice index.
 
FWDATATOOLS_API void getSliceIndex (::fwData::Integer::sptr index[3])
 Get the slice index.
 
FWDATATOOLS_API void updateImageInfos (::fwData::Image::sptr image)
 Update the image information (slice index, min/max,...)
 
FWDATATOOLS_API void createTransferFunction (::fwData::Image::sptr image)
 Create and set the default transfer function. More...
 
FWDATATOOLS_API void setOrCreateTF (const ::fwData::TransferFunction::sptr &_tf, const fwData::Image::sptr &_image)
 Sets the transfer function, creates one if _tf is null (. More...
 
FWDATATOOLS_API::fwData::TransferFunction::sptr getTransferFunction () const
 Get the current transfer function.
 

Protected Attributes

Orientation m_orientation
 Image orientation.
 
::fwData::Integer::sptr m_axialIndex
 Axial slice index.
 
::fwData::Integer::sptr m_frontalIndex
 Frontal slice index.
 
::fwData::Integer::sptr m_sagittalIndex
 Sagittal slice index.
 

Demangling methods

virtual const std::string & getLeafClassname () const
 return object's classname without its namespace, i.e. BaseObject
 
virtual const std::string & getClassname () const
 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
 

Connections to transfer function

typedef ::fwCom::Slot< void()> UpdateTFPointsSlotType
 Slot called when transfer function points are modified.
 
typedef ::fwCom::Slot< void(double, double)> UpdateTFWindowingSlotType
 Slot called when transfer function points are modified.
 
UpdateTFPointsSlotType::sptr m_slotUpdateTFPoints
 Slot called when transfer function points are modified.
 
UpdateTFWindowingSlotType::sptr m_slotUpdateTFWindowing
 Slot called when transfer function windowing is modified.
 
FWDATATOOLS_API void installTFConnections ()
 Install connections to listen TF modifications.
 
FWDATATOOLS_API void removeTFConnections ()
 Remove the TF connections.
 
FWDATATOOLS_API void installTFSlots (::fwCom::HasSlots *hasslots)
 Install the slots to managed TF modifications. More...
 
virtual FWDATATOOLS_API void updateTFPoints ()
 Slot: called when transfer function points are modified.
 
virtual FWDATATOOLS_API void updateTFWindowing (double window, double level)
 Slot: called when transfer function windowing is modified.
 

Detailed Description

Helpers for medical image.

Slots

The two slots must be reimplemented by the services managing transfer function

Definition at line 39 of file MedicalImageAdaptor.hpp.

Member Function Documentation

void fwDataTools::helper::MedicalImageAdaptor::createTransferFunction ( ::fwData::Image::sptr  image)
protected

Create and set the default transfer function.

Create the image's transfer function pool if if does not exist and then create the defaut transfer function. Set the current transfer function to the default grey-level if no transfer function was set (using setTransferFunction() ).

Definition at line 263 of file MedicalImageAdaptor.cpp.

References fwDataTools::helper::Composite::add(), fwDataTools::fieldHelper::MedicalImageHelpers::checkImageValidity(), fwDataTools::fieldHelper::MedicalImageHelpers::getMinMax(), fwDataTools::fieldHelper::Image::m_transferFunctionCompositeId, fwDataTools::helper::Composite::notify(), and fwData::TransferFunction::s_DEFAULT_TF_NAME.

Referenced by setOrCreateTF(), and scene2D::adaptor::SNegato::starting().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwDataTools::helper::MedicalImageAdaptor::getCurrentSliceCenter ( double  center[3])
protected

Get the slice center.

Parameters
[out]center: the slice center

Definition at line 91 of file MedicalImageAdaptor.cpp.

References getImage(), getImageOrigin(), getImageSize(), getImageSpacing(), getSliceIndex(), and m_orientation.

Referenced by visuVTKAdaptor::SSliceFollowerCamera::stopping().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwDataTools::helper::MedicalImageAdaptor::getImageDataSize ( int  size[3]) const
protected

Get the image data size (number of slices).

Parameters
[out]size: the image size

Definition at line 65 of file MedicalImageAdaptor.cpp.

References getImage().

Referenced by worldToImageSliceIndex().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename INT_INDEX >
void fwDataTools::helper::MedicalImageAdaptor::getImageDataSize ( INT_INDEX  size)
protected

Get the image data size (number of slices).

Parameters
[out]size: the image size

Definition at line 271 of file MedicalImageAdaptor.hpp.

void fwDataTools::helper::MedicalImageAdaptor::getImageOrigin ( double  origin[3]) const
protected

Get the image origin.

Parameters
[out]origin: the image origin

Definition at line 56 of file MedicalImageAdaptor.cpp.

References getImage().

Referenced by getCurrentSliceCenter(), sliceIndexToWorld(), visuVTKAdaptor::SSliceFollowerCamera::stopping(), and worldToSliceIndex().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwDataTools::helper::MedicalImageAdaptor::getImageSize ( double  size[3]) const
protected

Get the image size ( = dataSize * spacing ).

Parameters
[out]size: the image size

Definition at line 75 of file MedicalImageAdaptor.cpp.

References getImage(), and getImageSpacing().

Referenced by getCurrentSliceCenter(), and visuVTKAdaptor::SSliceFollowerCamera::stopping().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwDataTools::helper::MedicalImageAdaptor::getImageSpacing ( double  spacing[3]) const
protected

Get the image spacing.

Parameters
[out]spacing: the image spacing

Definition at line 46 of file MedicalImageAdaptor.cpp.

References getImage().

Referenced by getCurrentSliceCenter(), getImageSize(), sliceIndexToWorld(), and worldToSliceIndex().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename FLOAT_ARRAY_3 >
void fwDataTools::helper::MedicalImageAdaptor::getImageSpacing ( FLOAT_ARRAY_3  spacing)
protected

Get the image spacing.

Parameters
[out]spacing: the image spacing

Definition at line 261 of file MedicalImageAdaptor.hpp.

void fwDataTools::helper::MedicalImageAdaptor::getPlane ( double  points[4][3],
int  sliceNumber 
)
protected

Return the 4 points of the image plane.

  • points are ordered in the following way : image origin is the first point
  • points are inserted using the preference follow X axis if exists, if not exists follow Y axis if Y axis is not present follow Z axis

Definition at line 140 of file MedicalImageAdaptor.cpp.

References getImage(), and m_orientation.

+ Here is the call graph for this function:

void fwDataTools::helper::MedicalImageAdaptor::installTFSlots ( ::fwCom::HasSlots hasslots)
protected

Install the slots to managed TF modifications.

Creates slots to listen TF selection Composite and TransferFunction signals.

Warning
It must be called in the service constructor

Definition at line 368 of file MedicalImageAdaptor.cpp.

References m_slotUpdateTFPoints, m_slotUpdateTFWindowing, updateTFPoints(), and updateTFWindowing().

Referenced by uiImageQt::WindowLevel::WindowLevel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwDataTools::helper::MedicalImageAdaptor::setOrCreateTF ( const ::fwData::TransferFunction::sptr &  _tf,
const fwData::Image::sptr &  _image 
)
protected

Sets the transfer function, creates one if _tf is null (.

See also
createTransferFunction).

Connects the TF's signals to the updateTFPoints and updateTFWindowing slots.

Definition at line 307 of file MedicalImageAdaptor.cpp.

References createTransferFunction(), installTFConnections(), removeTFConnections(), and setTransferFunction().

Referenced by visuVTKAdaptor::SImageText::starting(), uiImageQt::WindowLevel::starting(), visuVTKAdaptor::SImage::starting(), visuVTKAdaptor::SImageText::swapping(), scene2D::adaptor::SNegato::swapping(), uiImageQt::WindowLevel::swapping(), and visuVTKAdaptor::SImage::swapping().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwDataTools::helper::MedicalImageAdaptor::setOrientation ( int  orientation)
protected

Set the orientation of the image.

Parameters
[in]orientationmust be 0 (X_AXIS), 1 (Y_AXIS) or 2 (Z_AXIS).

Definition at line 125 of file MedicalImageAdaptor.cpp.

References OSLM_ASSERT, and setOrientation().

+ Here is the call graph for this function:

void fwDataTools::helper::MedicalImageAdaptor::sliceIndexToWorld ( const int  index[3],
double  world[3] 
)
protected

Convert from world coordinates system to image coordinates system.

Parameters
[in]index: coordinate in the image
[out]world: coordinate in the world

Definition at line 164 of file MedicalImageAdaptor.cpp.

References getImageOrigin(), and getImageSpacing().

Referenced by visuVTKAdaptor::SImage3DCursor::swapping(), and visuVTKAdaptor::SImage3DCursor::updating().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void fwDataTools::helper::MedicalImageAdaptor::worldToImageSliceIndex ( const double  world[3],
int  index[3] 
)
protected

Convert coordinates in the world to coordinates in the image.

Parameters
[in]world: coordinate in the world
[out]index: coordinate in the image

Definition at line 195 of file MedicalImageAdaptor.cpp.

References getImageDataSize(), and worldToSliceIndex().

Referenced by visuVTKAdaptor::SImagesProbeCursor::stopping().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename WORLD , typename INT_INDEX >
void fwDataTools::helper::MedicalImageAdaptor::worldToImageSliceIndex ( const WORLD  world,
INT_INDEX *  index 
)
protected

Convert coordinates in the world to coordinates in the image.

Parameters
[in]world: coordinate in the world
[out]index: coordinate in the image

Definition at line 299 of file MedicalImageAdaptor.hpp.

void fwDataTools::helper::MedicalImageAdaptor::worldToSliceIndex ( const double  world[3],
int  index[3] 
)
protected

Convert world coordinates to slice index coordinates.

Parameters
[in]world: coordinate in the world
[out]index: coordinate in the slice index

Definition at line 178 of file MedicalImageAdaptor.cpp.

References getImageOrigin(), and getImageSpacing().

Referenced by worldToImageSliceIndex().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<typename WORLD , typename INT_INDEX >
void fwDataTools::helper::MedicalImageAdaptor::worldToSliceIndex ( const WORLD  world,
INT_INDEX *  index 
)
protected

Convert world coordinates to slice index coordinates.

Parameters
[in]world: coordinate in the world
[out]index: coordinate in the slice index

Definition at line 282 of file MedicalImageAdaptor.hpp.


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