Class that reads NavigationData from input and transfers the information to the geometry of the associated BaseData. More...
#include <mitkNavigationDataObjectVisualizationFilter.h>
Public Types | |
typedef NavigationDataObjectVisualizationFilter | Self |
typedef NavigationDataToNavigationDataFilter | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
typedef BaseData::ConstPointer | RepresentationPointer |
Smart Pointer type to a BaseData. | |
typedef std::map< unsigned int, RepresentationPointer > | RepresentationPointerMap |
STL map of index to BaseData . Using map to be able to set non continuous indices. | |
typedef RepresentationPointerMap::size_type | RepresentationPointerMapSizeType |
Size type of an std::vector. | |
Public Member Functions | |
virtual const char * | GetClassName () const |
void | SetRepresentationObject (unsigned int index, BaseData *data) |
Set the representation object of the input. | |
const BaseData * | GetRepresentationObject (unsigned int idx) |
Get the representation object associated with the index idx. | |
virtual void | SetTransformPosition (unsigned int index, bool applyTransform) |
if set to true, the filter will use the position part of the input navigation data at the given index to transform the representation object. If set to false, it will not. If no value is set, it defaults to true. | |
virtual bool | GetTransformPosition (unsigned int index) const |
returns whether position part of the input navigation data at the given index is used for the transformation of the representation object. | |
virtual void | TransformPositionOn (unsigned int index) |
sets the TransformPosition flag to true for the given index | |
virtual void | TransformPositionOff (unsigned int index) |
sets the TransformPosition flag to false for the given index | |
virtual void | SetTransformOrientation (unsigned int index, bool applyTransform) |
if set to true, the filter will use the orientation part of the input navigation data at the given index to transform the representation object. If set to false, it will not. If no value is set, it defaults to true. | |
virtual bool | GetTransformOrientation (unsigned int index) const |
returns whether orientation part of the input navigation data at the given index is used for the transformation of the representation object. | |
virtual void | TransformOrientationOn (unsigned int index) |
sets the TransformOrientation flag to true for the given index | |
virtual void | TransformOrientationOff (unsigned int index) |
sets the TransformOrientation flag to false for the given index | |
RepresentationPointerMapSizeType | GetNumberOfToolRepresentations () const |
Get the number of added BaseData associated to NavigationData. | |
virtual void | GenerateData () |
Static Public Member Functions | |
static Pointer | New () |
Protected Types | |
typedef std::map < itk::ProcessObject::DataObjectPointerArraySizeType, bool > | BooleanInputMap |
Protected Member Functions | |
NavigationDataObjectVisualizationFilter () | |
Constructor. | |
~NavigationDataObjectVisualizationFilter () | |
Destructor. | |
Protected Attributes | |
RepresentationPointerMap | m_RepresentationList |
An array of the BaseData which represent the tools. | |
BooleanInputMap | m_TransformPosition |
if set to true, the filter will use the position part of the input navigation data at the given index for the calculation of the transform. If no entry for the index exists, it defaults to true. | |
BooleanInputMap | m_TransformOrientation |
if set to true, the filter will use the orientation part of the input navigation data at the given index for the calculation of the transform. If no entry for the index exists, it defaults to true. |
Class that reads NavigationData from input and transfers the information to the geometry of the associated BaseData.
Derived from NavigationDataToNavigationDataFilter
Definition at line 35 of file mitkNavigationDataObjectVisualizationFilter.h.
typedef std::map<itk::ProcessObject::DataObjectPointerArraySizeType, bool> mitk::NavigationDataObjectVisualizationFilter::BooleanInputMap [protected] |
Definition at line 100 of file mitkNavigationDataObjectVisualizationFilter.h.
typedef itk::SmartPointer<const Self> mitk::NavigationDataObjectVisualizationFilter::ConstPointer |
Reimplemented from mitk::NavigationDataToNavigationDataFilter.
Definition at line 38 of file mitkNavigationDataObjectVisualizationFilter.h.
typedef itk::SmartPointer<Self> mitk::NavigationDataObjectVisualizationFilter::Pointer |
Reimplemented from mitk::NavigationDataToNavigationDataFilter.
Definition at line 38 of file mitkNavigationDataObjectVisualizationFilter.h.
Smart Pointer type to a BaseData.
Definition at line 40 of file mitkNavigationDataObjectVisualizationFilter.h.
typedef std::map<unsigned int, RepresentationPointer> mitk::NavigationDataObjectVisualizationFilter::RepresentationPointerMap |
STL map of index to BaseData . Using map to be able to set non continuous indices.
Definition at line 50 of file mitkNavigationDataObjectVisualizationFilter.h.
typedef RepresentationPointerMap::size_type mitk::NavigationDataObjectVisualizationFilter::RepresentationPointerMapSizeType |
Size type of an std::vector.
Definition at line 55 of file mitkNavigationDataObjectVisualizationFilter.h.
Reimplemented from mitk::NavigationDataToNavigationDataFilter.
Definition at line 38 of file mitkNavigationDataObjectVisualizationFilter.h.
typedef NavigationDataToNavigationDataFilter mitk::NavigationDataObjectVisualizationFilter::Superclass |
Reimplemented from mitk::NavigationDataToNavigationDataFilter.
Definition at line 38 of file mitkNavigationDataObjectVisualizationFilter.h.
mitk::NavigationDataObjectVisualizationFilter::NavigationDataObjectVisualizationFilter | ( | ) | [protected] |
Constructor.
Definition at line 22 of file mitkNavigationDataObjectVisualizationFilter.cpp.
mitk::NavigationDataObjectVisualizationFilter::~NavigationDataObjectVisualizationFilter | ( | ) | [protected] |
Destructor.
Definition at line 29 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ m_RepresentationList.clear(); }
void mitk::NavigationDataObjectVisualizationFilter::GenerateData | ( | ) | [virtual] |
*set the offset by convert from itkPoint to itkVector and setting offset of transform*/
Definition at line 69 of file mitkNavigationDataObjectVisualizationFilter.cpp.
References mitk::BaseData::GetGeometry(), mitk::Geometry3D::GetIndexToWorldTransform(), mitk::NavigationData::GetOrientation(), mitk::NavigationData::GetPosition(), mitk::Geometry3D::GetSpacing(), mitk::NavigationData::Graft(), mitk::NavigationData::IsDataValid(), mitk::NavigationData::SetDataValid(), mitk::Geometry3D::SetIndexToWorldTransform(), mitk::Geometry3D::SetSpacing(), and mitk::Geometry3D::TransferItkToVtkTransform().
{ /*get each input, lookup the associated BaseData and transfer the data*/ DataObjectPointerArray inputs = this->GetInputs(); //get all inputs for (unsigned int index=0; index < inputs.size(); index++) { //get the needed variables const mitk::NavigationData* nd = this->GetInput(index); assert(nd); mitk::NavigationData* output = this->GetOutput(index); assert(output); //check if the data is valid if (!nd->IsDataValid()) { output->SetDataValid(false); continue; } output->Graft(nd); // copy all information from input to output const mitk::BaseData* data = this->GetRepresentationObject(index); if (data == NULL) { itkWarningMacro("NavigationDataObjectVisualizationFilter: Wrong/No BaseData associated with input."); return; } //get the transform from data mitk::AffineTransform3D::Pointer affineTransform = data->GetGeometry()->GetIndexToWorldTransform(); if (affineTransform.IsNull()) { //replace with mitk standard output itkWarningMacro("NavigationDataObjectVisualizationFilter: AffineTransform IndexToWorldTransform not initialized!"); return; } //store the current scaling to set it after transformation mitk::Vector3D spacing = data->GetGeometry()->GetSpacing(); //clear spacing of data to be able to set it again afterwards float scale[] = {1.0, 1.0, 1.0}; data->GetGeometry()->SetSpacing(scale); /*now bring quaternion to affineTransform by using vnl_Quaternion*/ affineTransform->SetIdentity(); if (this->GetTransformOrientation(index) == true) { //calculate the transform from the quaternions static itk::QuaternionRigidTransform<double>::Pointer quatTransform = itk::QuaternionRigidTransform<double>::New(); mitk::NavigationData::OrientationType orientation = nd->GetOrientation(); // convert mitk::ScalarType quaternion to double quaternion because of itk bug vnl_quaternion<double> doubleQuaternion(orientation.x(), orientation.y(), orientation.z(), orientation.r()); quatTransform->SetIdentity(); quatTransform->SetRotation(doubleQuaternion); quatTransform->Modified(); /* because of an itk bug, the transform can not be calculated with float data type. To use it in the mitk geometry classes, it has to be transfered to mitk::ScalarType which is float */ static AffineTransform3D::MatrixType m; mitk::TransferMatrix(quatTransform->GetMatrix(), m); affineTransform->SetMatrix(m); } if (this->GetTransformPosition(index) == true) { mitk::Vector3D pos; pos.Set_vnl_vector(nd->GetPosition().Get_vnl_vector()); affineTransform->SetOffset(pos); } affineTransform->Modified(); //set the transform to data data->GetGeometry()->SetIndexToWorldTransform(affineTransform); //set the original spacing to keep scaling of the geometrical object data->GetGeometry()->SetSpacing(spacing); data->GetGeometry()->TransferItkToVtkTransform(); // update VTK Transform for rendering too data->GetGeometry()->Modified(); data->Modified(); output->SetDataValid(true); // operation was successful, therefore data of output is valid. } }
virtual const char* mitk::NavigationDataObjectVisualizationFilter::GetClassName | ( | ) | const [virtual] |
Reimplemented from mitk::NavigationDataToNavigationDataFilter.
RepresentationPointerMapSizeType mitk::NavigationDataObjectVisualizationFilter::GetNumberOfToolRepresentations | ( | ) | const [inline] |
Get the number of added BaseData associated to NavigationData.
Definition at line 88 of file mitkNavigationDataObjectVisualizationFilter.h.
{ return m_RepresentationList.size(); }
const mitk::BaseData * mitk::NavigationDataObjectVisualizationFilter::GetRepresentationObject | ( | unsigned int | idx ) |
Get the representation object associated with the index idx.
idx | the corresponding input number with which the BaseData is associated |
Definition at line 35 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ //if (idx >= this->GetNumberOfInputs()) // return NULL; //const NavigationData* nd = this->GetInput(idx); //if (nd == NULL) // return NULL; RepresentationPointerMap::const_iterator iter = m_RepresentationList.find(idx); if (iter != m_RepresentationList.end()) return iter->second; return NULL; }
bool mitk::NavigationDataObjectVisualizationFilter::GetTransformOrientation | ( | unsigned int | index ) | const [virtual] |
returns whether orientation part of the input navigation data at the given index is used for the transformation of the representation object.
Definition at line 200 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ itkDebugMacro("returning TransformOrientation for index " << index); BooleanInputMap::const_iterator it = this->m_TransformOrientation.find(index); if (it != this->m_TransformOrientation.end()) return it->second; else return true; // default to true }
bool mitk::NavigationDataObjectVisualizationFilter::GetTransformPosition | ( | unsigned int | index ) | const [virtual] |
returns whether position part of the input navigation data at the given index is used for the transformation of the representation object.
Definition at line 165 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ itkDebugMacro("returning TransformPosition for index " << index); BooleanInputMap::const_iterator it = this->m_TransformPosition.find(index); if (it != this->m_TransformPosition.end()) return it->second; else return true; // default to true }
static Pointer mitk::NavigationDataObjectVisualizationFilter::New | ( | ) | [static] |
void mitk::NavigationDataObjectVisualizationFilter::SetRepresentationObject | ( | unsigned int | index, |
BaseData * | data | ||
) |
Set the representation object of the input.
data | The BaseData to be associated to the index |
index | the index with which data will be associated |
Definition at line 52 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ //if (idx >= this->GetNumberOfInputs()) // return false; //const NavigationData* nd = this->GetInput(idx); //if (nd == NULL || data == NULL) // return false; m_RepresentationList[idx] = RepresentationPointer(data); //std::pair<RepresentationPointerMap::iterator, bool> returnEl; //pair for returning the result //returnEl = m_RepresentationList.insert( RepresentationPointerMap::value_type(nd, data) ); //insert the given elements //return returnEl.second; // return if insert was successful }
void mitk::NavigationDataObjectVisualizationFilter::SetTransformOrientation | ( | unsigned int | index, |
bool | applyTransform | ||
) | [virtual] |
if set to true, the filter will use the orientation part of the input navigation data at the given index to transform the representation object. If set to false, it will not. If no value is set, it defaults to true.
Definition at line 188 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ itkDebugMacro("setting TransformOrientation for index " << index << " to " << applyTransform); BooleanInputMap::const_iterator it = this->m_TransformOrientation.find(index); if ((it != this->m_TransformOrientation.end()) && (it->second == applyTransform)) return; this->m_TransformOrientation[index] = applyTransform; this->Modified(); \ }
void mitk::NavigationDataObjectVisualizationFilter::SetTransformPosition | ( | unsigned int | index, |
bool | applyTransform | ||
) | [virtual] |
if set to true, the filter will use the position part of the input navigation data at the given index to transform the representation object. If set to false, it will not. If no value is set, it defaults to true.
Definition at line 153 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ itkDebugMacro("setting TransformPosition for index " << index << " to " << applyTransform); BooleanInputMap::const_iterator it = this->m_TransformPosition.find(index); if ((it != this->m_TransformPosition.end()) && (it->second == applyTransform)) return; this->m_TransformPosition[index] = applyTransform; this->Modified(); \ }
void mitk::NavigationDataObjectVisualizationFilter::TransformOrientationOff | ( | unsigned int | index ) | [virtual] |
sets the TransformOrientation flag to false for the given index
Definition at line 217 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ this->SetTransformOrientation(index, false); }
void mitk::NavigationDataObjectVisualizationFilter::TransformOrientationOn | ( | unsigned int | index ) | [virtual] |
sets the TransformOrientation flag to true for the given index
Definition at line 211 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ this->SetTransformOrientation(index, true); }
void mitk::NavigationDataObjectVisualizationFilter::TransformPositionOff | ( | unsigned int | index ) | [virtual] |
sets the TransformPosition flag to false for the given index
Definition at line 182 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ this->SetTransformPosition(index, false); }
void mitk::NavigationDataObjectVisualizationFilter::TransformPositionOn | ( | unsigned int | index ) | [virtual] |
sets the TransformPosition flag to true for the given index
Definition at line 176 of file mitkNavigationDataObjectVisualizationFilter.cpp.
{ this->SetTransformPosition(index, true); }
RepresentationPointerMap mitk::NavigationDataObjectVisualizationFilter::m_RepresentationList [protected] |
An array of the BaseData which represent the tools.
Definition at line 115 of file mitkNavigationDataObjectVisualizationFilter.h.
if set to true, the filter will use the orientation part of the input navigation data at the given index for the calculation of the transform. If no entry for the index exists, it defaults to true.
Definition at line 117 of file mitkNavigationDataObjectVisualizationFilter.h.
if set to true, the filter will use the position part of the input navigation data at the given index for the calculation of the transform. If no entry for the index exists, it defaults to true.
Definition at line 116 of file mitkNavigationDataObjectVisualizationFilter.h.