Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

mitk::PlanesPerpendicularToLinesFilter Class Reference

Create Planes perpendicular to lines contained in a Mesh. The planes data is generated as one SlicedGeometry3D data. To create the planes as input a mitk::mesh (for example a pointSet) and as geometry hint a geometry (for example from the original image) must be given. More...

#include <mitkPlanesPerpendicularToLinesFilter.h>

Inheritance diagram for mitk::PlanesPerpendicularToLinesFilter:
Inheritance graph
[legend]
Collaboration diagram for mitk::PlanesPerpendicularToLinesFilter:
Collaboration graph
[legend]

List of all members.

Public Types

typedef
PlanesPerpendicularToLinesFilter 
Self
typedef GeometryDataSource Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
virtual void GenerateOutputInformation ()
virtual void GenerateData ()
const mitk::MeshGetInput (void)
virtual void SetInput (const mitk::Mesh *image)
virtual void SetPlane (const mitk::PlaneGeometry *aPlane)
 Set plane to be used as an example of the planes to move along the lines in the input mesh.
virtual bool GetUseAllPoints () const
 Set if all points in the mesh should be interpreted as one long line.
virtual void SetUseAllPoints (bool _arg)
 Set if all points of the mesh shall be used (true) or the cells (false) Default is false.
virtual void UseAllPointsOn ()
virtual void UseAllPointsOff ()
virtual void SetFrameGeometry (const mitk::Geometry3D *frameGeometry)
 Set an explicit frame of the created sliced geometry.

Static Public Member Functions

static Pointer New ()

Protected Member Functions

 PlanesPerpendicularToLinesFilter ()
virtual ~PlanesPerpendicularToLinesFilter ()
void CreatePlane (const Point3D &curr)

Protected Attributes

mitk::PlaneGeometry::Pointer m_Plane
bool m_UseAllPoints
SlicedGeometry3D::Pointer m_CreatedGeometries
 SlicedGeometry3D containing the created planes.
mitk::Geometry3D::Pointer m_FrameGeometry

Detailed Description

Create Planes perpendicular to lines contained in a Mesh. The planes data is generated as one SlicedGeometry3D data. To create the planes as input a mitk::mesh (for example a pointSet) and as geometry hint a geometry (for example from the original image) must be given.

mitk::Mesh::Pointer mesh = mitk::Mesh::New(); mesh->SetMesh(pointSet->GetPointSet()); mitk::Image* currentImage = dynamic_cast<mitk::Image*> (myDataStorage->GetNamedNode(IMAGE)->GetData()); const mitk::Geometry3D* imagegeometry = currentImage->GetUpdatedGeometry(); mitk::PlanesPerpendicularToLinesFilter::Pointer perpendicularPlanes = mitk::PlanesPerpendicularToLinesFilter::New(); perpendicularPlanes->SetInput(mesh); perpendicularPlanes->SetUseAllPoints(true); perpendicularPlanes->SetFrameGeometry(imagegeometry); perpendicularPlanes->Update();

To get one single plane out of these use SlicedGeometry3D->GetGeometry2D(int slicenumber).

Definition at line 50 of file mitkPlanesPerpendicularToLinesFilter.h.


Member Typedef Documentation

Reimplemented from mitk::GeometryDataSource.

Definition at line 53 of file mitkPlanesPerpendicularToLinesFilter.h.

Reimplemented from mitk::GeometryDataSource.

Definition at line 53 of file mitkPlanesPerpendicularToLinesFilter.h.

Reimplemented from mitk::GeometryDataSource.

Definition at line 53 of file mitkPlanesPerpendicularToLinesFilter.h.

Reimplemented from mitk::GeometryDataSource.

Definition at line 53 of file mitkPlanesPerpendicularToLinesFilter.h.


Constructor & Destructor Documentation

mitk::PlanesPerpendicularToLinesFilter::PlanesPerpendicularToLinesFilter (  ) [protected]

Definition at line 24 of file mitkPlanesPerpendicularToLinesFilter.cpp.

References m_CreatedGeometries, and New().

  : m_Plane(NULL), m_UseAllPoints(false), m_CreatedGeometries(NULL), normal(3), targetRight(3)
{
  m_CreatedGeometries = mitk::SlicedGeometry3D::New();
}
mitk::PlanesPerpendicularToLinesFilter::~PlanesPerpendicularToLinesFilter (  ) [protected, virtual]

Definition at line 30 of file mitkPlanesPerpendicularToLinesFilter.cpp.

{
}

Member Function Documentation

void mitk::PlanesPerpendicularToLinesFilter::CreatePlane ( const Point3D &  curr ) [protected]
void mitk::PlanesPerpendicularToLinesFilter::GenerateData (  ) [virtual]

Definition at line 78 of file mitkPlanesPerpendicularToLinesFilter.cpp.

References mitk::Geometry3D::SetOrigin().

{
  mitk::Mesh::ConstPointer input  = this->GetInput();
  mitk::GeometryData::Pointer output = this->GetOutput();

  if(m_Plane.IsNotNull())
  {
    targetRight   = m_Plane->GetMatrixColumn(0);
    targetSpacing = m_Plane->GetSpacing();
    bounds = m_Plane->GetBoundingBox()->GetBounds();
    halfWidthInMM  = m_Plane->GetExtentInMM(0)*0.5;
    halfHeightInMM = m_Plane->GetExtentInMM(1)*0.5;
  }
  else
  {
    FillVector3D(targetRight, 1.0, 0.0, 0.0);
    targetSpacing.Fill(1.0);
    halfWidthInMM=halfHeightInMM=100.0;
    ScalarType stdBounds[6] = {0.0, 2.0*halfWidthInMM, 0.0, 2.0*halfHeightInMM, 0.0, 0.0};
    bounds = stdBounds;
  }

  if(m_UseAllPoints==false)
  {
    int i, size;
    //iterate through all cells and build planes
    Mesh::ConstCellIterator cellIt, cellEnd;
    cellEnd = input->GetMesh()->GetCells()->End();
    for( cellIt = input->GetMesh()->GetCells()->Begin(); cellIt != cellEnd; ++cellIt )
    {
      Mesh::CellType& cell = *cellIt->Value();

      Mesh::PointIdIterator ptIt, ptEnd;
      ptEnd = cell.PointIdsEnd();

      size=cell.GetNumberOfPoints();
      if(size<=1)
        continue;

      ptIt = cell.PointIdsBegin();
      last = input->GetPoint(*ptIt);
      ++ptIt;
      for(i=1;i<size;++i, ++ptIt)
      {
        CreatePlane(input->GetPoint(*ptIt));
      }
    }
  }
  else //m_UseAllPoints==true
  {
    //iterate through all points and build planes
    mitk::PointSet::PointsConstIterator it, pend = input->GetPointSet()->GetPoints()->End();
    it=input->GetPointSet()->GetPoints()->Begin();
    last = it.Value();
    ++it;
    for(;it!=pend;++it)
    {
        CreatePlane(it.Value());
    }
  }

  if(planes.size()>0)
  {
    //initialize sliced-geometry for the number of created planes
    m_CreatedGeometries->Initialize(planes.size()+1);

    //set last plane at last point with same normal as the one before the last
    PlaneGeometry::Pointer plane = static_cast<PlaneGeometry*>((*planes.rbegin())->Clone().GetPointer());
    itk2vtk(last.Get_vnl_vector()-right*halfWidthInMM-down*halfHeightInMM, origin);
    plane->SetOrigin(origin);
    m_CreatedGeometries->SetGeometry2D(plane, planes.size());

    //add all planes to sliced-geometry
    int s;
    for(s=0; planes.empty()==false; planes.pop_front(), ++s)
    {
      m_CreatedGeometries->SetGeometry2D(planes.front(), s);
    }

    m_CreatedGeometries->SetEvenlySpaced(false);

    if(m_FrameGeometry.IsNotNull())
    {
      m_CreatedGeometries->SetIndexToWorldTransform(m_FrameGeometry->GetIndexToWorldTransform());
      m_CreatedGeometries->SetBounds(m_FrameGeometry->GetBounds());
      m_CreatedGeometries->SetReferenceGeometry(m_FrameGeometry);
    }
  }

  output->SetGeometry(m_CreatedGeometries);
}
void mitk::PlanesPerpendicularToLinesFilter::GenerateOutputInformation ( void   ) [virtual]

Definition at line 34 of file mitkPlanesPerpendicularToLinesFilter.cpp.

{
  mitk::Mesh::ConstPointer input  = this->GetInput();
  mitk::GeometryData::Pointer output = this->GetOutput();

  itkDebugMacro(<<"GenerateOutputInformation()");

  if(input.IsNull()) return;

  output->SetGeometry(m_CreatedGeometries);
}
virtual const char* mitk::PlanesPerpendicularToLinesFilter::GetClassName (  ) const [virtual]

Reimplemented from mitk::GeometryDataSource.

const mitk::Mesh * mitk::PlanesPerpendicularToLinesFilter::GetInput ( void   )

Definition at line 185 of file mitkPlanesPerpendicularToLinesFilter.cpp.

{
  if (this->GetNumberOfInputs() < 1)
  {
    return 0;
  }

  return static_cast<const mitk::Mesh * >
    (this->ProcessObject::GetInput(0) );
}
virtual bool mitk::PlanesPerpendicularToLinesFilter::GetUseAllPoints (  ) const [virtual]

Set if all points in the mesh should be interpreted as one long line.

Cells are not used in this mode, but all points in the order of their indices form the line. Default is false.

static Pointer mitk::PlanesPerpendicularToLinesFilter::New (  ) [static]
void mitk::PlanesPerpendicularToLinesFilter::SetFrameGeometry ( const mitk::Geometry3D frameGeometry ) [virtual]

Set an explicit frame of the created sliced geometry.

Set an explicit framegeometry for the created sliced geometry. This framegeometry is used as geometry for all created planes. Uses the IndexToWorldTransform and bounding box of the provided geometry.

See also:
CalculateFrameGeometry

Definition at line 203 of file mitkPlanesPerpendicularToLinesFilter.cpp.

References mitk::Geometry3D::Clone(), and mitk::Geometry3D::IsValid().

{
  if((frameGeometry != NULL) && (frameGeometry->IsValid()))
  {
    m_FrameGeometry = static_cast<mitk::Geometry3D*>(frameGeometry->Clone().GetPointer());
  }
  else
  {
    m_FrameGeometry = NULL;
  }
}
void mitk::PlanesPerpendicularToLinesFilter::SetInput ( const mitk::Mesh image ) [virtual]

Definition at line 196 of file mitkPlanesPerpendicularToLinesFilter.cpp.

{
  // Process object is not const-correct so the const_cast is required here
  this->ProcessObject::SetNthInput(0, 
    const_cast< mitk::Mesh * >( input ) );
}
void mitk::PlanesPerpendicularToLinesFilter::SetPlane ( const mitk::PlaneGeometry aPlane ) [virtual]

Set plane to be used as an example of the planes to move along the lines in the input mesh.

The size and spacing are copied from the plane. The in-plane orientation (right-vector) of the created planes are set as parallel as possible to the orientation (right-vector) of the the plane set using this method.

Note:
The PlaneGeometry is cloned, not linked/referenced.

Definition at line 170 of file mitkPlanesPerpendicularToLinesFilter.cpp.

References mitk::PlaneGeometry::Clone().

{
  if(aPlane!=NULL)
  {
    m_Plane = static_cast<mitk::PlaneGeometry*>(aPlane->Clone().GetPointer());
  }
  else
  {
    if(m_Plane.IsNull())
      return;
    m_Plane=NULL;
  }
  Modified();
}
virtual void mitk::PlanesPerpendicularToLinesFilter::SetUseAllPoints ( bool  _arg ) [virtual]

Set if all points of the mesh shall be used (true) or the cells (false) Default is false.

virtual void mitk::PlanesPerpendicularToLinesFilter::UseAllPointsOff (  ) [virtual]
virtual void mitk::PlanesPerpendicularToLinesFilter::UseAllPointsOn (  ) [virtual]

Member Data Documentation

SlicedGeometry3D containing the created planes.

Definition at line 127 of file mitkPlanesPerpendicularToLinesFilter.h.

Referenced by PlanesPerpendicularToLinesFilter().

Definition at line 129 of file mitkPlanesPerpendicularToLinesFilter.h.

Definition at line 120 of file mitkPlanesPerpendicularToLinesFilter.h.

Definition at line 122 of file mitkPlanesPerpendicularToLinesFilter.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines