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

mitk::SeedsImage Class Reference
[Data Classes]

SeedsImage class for storing seeds-images. More...

#include <mitkSeedsImage.h>

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

List of all members.

Public Types

typedef SeedsImage Self
typedef Image Superclass
typedef itk::SmartPointer< SelfPointer
typedef itk::SmartPointer
< const Self
ConstPointer

Public Member Functions

virtual const char * GetClassName () const
virtual mitk::Point3D GetLastPoint ()
void Initialize ()
virtual void ExecuteOperation (Operation *operation)
 handles operations
void ClearBuffer ()

Static Public Member Functions

static Pointer New ()

Protected Types

typedef itk::Image< float, 3 > MaskImageType
typedef
itk::GaussianSpatialFunction
< int, 3 > 
GaussianFunction3DType
typedef
itk::GaussianSpatialFunction
< int, 2 > 
GaussianFunction2DType
typedef
itk::BinaryBallStructuringElement
< short, 3 > 
BallStructuringElement3DType
typedef
itk::BinaryBallStructuringElement
< short, 2 > 
BallStructuringElement2DType

Protected Member Functions

 SeedsImage ()
virtual ~SeedsImage ()
template<typename SeedsImageType >
itk::NeighborhoodIterator
< SeedsImageType > & 
GetNit (SeedsImageType *image)
template<typename SeedsImageType >
void AddSeedPoint (SeedsImageType *itkImage)
 sets a sphere of seeds around the point
template<typename SeedsImageType >
void PointInterpolation (SeedsImageType *itkImage)
 interpolates a tube of seeds between two points
template<typename SeedsImageType >
void ClearBuffer (SeedsImageType *itkImage)
 interpolates a tube of seeds between two points

Protected Attributes

mitk::Point3D m_Point
mitk::Point3D m_LastPoint
mitk::Vector3D m_Spacing
int orig_size [3]
int m_DrawState
int m_Radius
float delta_x
float delta_y
float delta_z
float sphere_distance
GaussianFunction3DType::Pointer m_GaussianFunction3D
GaussianFunction2DType::Pointer m_GaussianFunction2D
BallStructuringElement3DType m_StructuringElement3D
BallStructuringElement2DType m_StructuringElement2D

Detailed Description

SeedsImage class for storing seeds-images.

Handles operations for drawing seeds.

Definition at line 39 of file mitkSeedsImage.h.


Member Typedef Documentation

typedef itk::BinaryBallStructuringElement< short, 2 > mitk::SeedsImage::BallStructuringElement2DType [protected]

Definition at line 96 of file mitkSeedsImage.h.

typedef itk::BinaryBallStructuringElement< short, 3 > mitk::SeedsImage::BallStructuringElement3DType [protected]

Definition at line 94 of file mitkSeedsImage.h.

typedef itk::SmartPointer<const Self> mitk::SeedsImage::ConstPointer

Reimplemented from mitk::Image.

Definition at line 44 of file mitkSeedsImage.h.

typedef itk::GaussianSpatialFunction< int, 2 > mitk::SeedsImage::GaussianFunction2DType [protected]

Definition at line 91 of file mitkSeedsImage.h.

typedef itk::GaussianSpatialFunction< int, 3 > mitk::SeedsImage::GaussianFunction3DType [protected]

Definition at line 89 of file mitkSeedsImage.h.

typedef itk::Image<float,3> mitk::SeedsImage::MaskImageType [protected]

Definition at line 87 of file mitkSeedsImage.h.

typedef itk::SmartPointer<Self> mitk::SeedsImage::Pointer

Reimplemented from mitk::Image.

Definition at line 44 of file mitkSeedsImage.h.

Reimplemented from mitk::Image.

Definition at line 44 of file mitkSeedsImage.h.

Reimplemented from mitk::Image.

Definition at line 44 of file mitkSeedsImage.h.


Constructor & Destructor Documentation

mitk::SeedsImage::SeedsImage (  ) [protected]
mitk::SeedsImage::~SeedsImage (  ) [protected, virtual]

Definition at line 37 of file mitkSeedsImage.cpp.

{
}

Member Function Documentation

template<typename SeedsImageType >
void mitk::SeedsImage::AddSeedPoint ( SeedsImageType *  itkImage ) [protected]

sets a sphere of seeds around the point

Definition at line 121 of file mitkSeedsImage.cpp.

References int().

{ 
  typedef itk::NeighborhoodIterator< SeedsImageType >
    NeighborhoodIteratorType;
  typedef typename NeighborhoodIteratorType::IndexType IndexType;

  NeighborhoodIteratorType& nit = this->GetNit< SeedsImageType >( itkImage );

  const unsigned int dimension =
    ::itk::GetImageDimension<SeedsImageType>::ImageDimension;

  mitk::Point3D index;
  this->GetGeometry()->WorldToIndex( m_Point, index );

  IndexType itkIndex;
  unsigned int d;
  for ( d = 0; d < dimension; ++d )
  {
    itkIndex[d] = (int)(index[d] + 0.5);
  }
  nit.SetLocation( itkIndex );

  
  unsigned int i;
  for ( i = 0; i < nit.Size(); ++i )
  {
    if ( nit[i] != 0 )
    {
      try
      {
        nit.SetPixel( i, m_DrawState );
      }
      catch( itk::RangeError & )
      {
      }
    }
  }
}
void mitk::SeedsImage::ClearBuffer (  )

Definition at line 216 of file mitkSeedsImage.cpp.

References AccessByItk.

template<typename SeedsImageType >
void mitk::SeedsImage::ClearBuffer ( SeedsImageType *  itkImage ) [protected]

interpolates a tube of seeds between two points

Definition at line 222 of file mitkSeedsImage.cpp.

{
  itkImage->FillBuffer(0);
}
void mitk::SeedsImage::ExecuteOperation ( mitk::Operation operation ) [virtual]

handles operations

Reimplemented from mitk::BaseData.

Definition at line 48 of file mitkSeedsImage.cpp.

References AccessByItk, mitk::DrawOperation::GetDrawState(), mitk::RenderingManager::GetInstance(), mitk::Operation::GetOperationType(), mitk::DrawOperation::GetPoint(), mitk::DrawOperation::GetRadius(), mitk::OpADD, mitk::OpMOVE, mitk::OpUNDOADD, mitk::OpUNDOMOVE, and mitk::RenderingManager::RequestUpdateAll().

{
  //mitkCheckOperationTypeMacro(SeedsOperation, operation, seedsOp);
  m_Spacing = this->GetGeometry()->GetSpacing();
  for(unsigned int i=0; i<this->GetDimension(); i++)
    orig_size[i] = this->GetDimension(i);

  mitk::DrawOperation * seedsOp = 
    dynamic_cast< mitk::DrawOperation * >( operation );

  if ( seedsOp != NULL )
  {
    m_DrawState = seedsOp->GetDrawState();
  
    if (m_Radius != seedsOp->GetRadius())
    {
      m_Radius = seedsOp->GetRadius();
    }

    switch (operation->GetOperationType())
    {
    case mitk::OpADD:
      { 
        m_Point = seedsOp->GetPoint();
        m_LastPoint = m_Point;
        AccessByItk(this, AddSeedPoint);
        break;
      }
    case mitk::OpMOVE:
      {
        m_Point = seedsOp->GetPoint();
        AccessByItk(this, AddSeedPoint);
        AccessByItk(this, PointInterpolation);
        m_LastPoint = m_Point;
        break;
      }
    case mitk::OpUNDOADD:
      {
        m_Point = seedsOp->GetPoint();
        m_LastPoint = m_Point;
        m_DrawState = 0;
        
        // todo - operation is not equal with its inverse operation - possible 
        // approximation problems in the function PointInterpolation()
        m_Radius = m_Radius+4;
        AccessByItk(this, AddSeedPoint);
        break;
      }
    case mitk::OpUNDOMOVE:
      {
        m_Point = seedsOp->GetPoint();
        m_DrawState = 0;
        
        // todo - operation is not equal with its inverse operation - possible 
        // approximation problems in the function PointInterpolation()
        m_Radius = m_Radius+4;
        AccessByItk(this, AddSeedPoint);
        AccessByItk(this, PointInterpolation);
        m_LastPoint = m_Point;
        break;
      }
    }
    
    //*todo has to be done here, cause of update-pipeline not working yet
    mitk::RenderingManager::GetInstance()->RequestUpdateAll();
    //mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();

    this->Modified();
  }
}
virtual const char* mitk::SeedsImage::GetClassName (  ) const [virtual]

Reimplemented from mitk::Image.

virtual mitk::Point3D mitk::SeedsImage::GetLastPoint (  ) [virtual]
template<typename SeedsImageType >
itk::NeighborhoodIterator< SeedsImageType > & mitk::SeedsImage::GetNit ( SeedsImageType *  image ) [protected]

Definition at line 229 of file mitkSeedsImage.cpp.

References QuadProgPP::dist().

{
  typedef itk::NeighborhoodIterator< SeedsImageType >
    NeighborhoodIteratorType;
  typedef typename NeighborhoodIteratorType::OffsetType OffsetType;
  typedef typename NeighborhoodIteratorType::SizeType SizeType;
  typedef itk::GaussianSpatialFunction< int, SeedsImageType::ImageDimension >
    GaussianFunctionType;

  static SeedsImageType* iteratedImage = 0;
  static NeighborhoodIteratorType nit;
  static typename GaussianFunctionType::Pointer gaussianFunction
    = GaussianFunctionType::New();

  if ( iteratedImage != image )
  {
    SizeType radius;
    radius.Fill( m_Radius);
    nit.Initialize( radius, image, image->GetBufferedRegion() );
    iteratedImage = image;
  }

  nit.SetRadius( m_Radius );

  unsigned int i;
  for ( i = 0; i < nit.GetCenterNeighborhoodIndex()*2+1; ++i )
  {
    OffsetType offset = nit.GetOffset( i );

    typename GaussianFunctionType::InputType point;
    double dist = 0;
    unsigned int d;
    for ( d = 0; d < SeedsImageType::ImageDimension; ++d )
    {
      point[d] = offset[d];
      dist += offset[d] * offset[d];
    }
  }

  return nit;
}
void mitk::SeedsImage::Initialize ( void   ) [virtual]

Reimplemented from mitk::Image.

Definition at line 41 of file mitkSeedsImage.cpp.

static Pointer mitk::SeedsImage::New (  ) [static]

Reimplemented from mitk::Image.

Referenced by SeedsImage(), and mitkDataNodeExtTestClass::TestDataSetting().

template<typename SeedsImageType >
void mitk::SeedsImage::PointInterpolation ( SeedsImageType *  itkImage ) [protected]

interpolates a tube of seeds between two points

Definition at line 162 of file mitkSeedsImage.cpp.

References int().

{
  typedef itk::NeighborhoodIterator< SeedsImageType >
    NeighborhoodIteratorType;
  typedef typename NeighborhoodIteratorType::IndexType IndexType;


  NeighborhoodIteratorType& nit = this->GetNit< SeedsImageType >( itkImage );

  const unsigned int dimension = 
    ::itk::GetImageDimension<SeedsImageType>::ImageDimension;

  mitk::Point3D indexBegin, indexEnd;
  this->GetGeometry()->WorldToIndex( m_Point, indexBegin );
  this->GetGeometry()->WorldToIndex( m_LastPoint, indexEnd );

  IndexType itkIndexBegin, itkIndexEnd;
  unsigned int d;
  for ( d = 0; d < dimension; ++d )
  {
    itkIndexBegin[d] = (int)(indexBegin[d] + 0.5);
    itkIndexEnd[d] = (int)(indexEnd[d] + 0.5);
  }


  typedef itk::LineConstIterator< SeedsImageType > LineIteratorType;
  LineIteratorType lit( itkImage, itkIndexBegin, itkIndexEnd );

  // Disable warnings (which would otherwise be displayed if line leaves the
  // region).
  bool warningDisplay = itk::Object::GetGlobalWarningDisplay();
  itk::Object::GlobalWarningDisplayOff();
  for ( lit.GoToBegin(); !lit.IsAtEnd(); ++lit )
  {
    nit.SetLocation( lit.GetIndex() );

    unsigned int i;
    for ( i = 0; i < nit.Size(); ++i )
    {
      if ( nit[i] != 0 )
      {
        try
        {
          nit.SetPixel( i, m_DrawState );
        }
        catch( itk::RangeError & )
        {
        }
      }
    }
  }
  itk::Object::SetGlobalWarningDisplay( warningDisplay );
}

Member Data Documentation

float mitk::SeedsImage::delta_x [protected]

Definition at line 84 of file mitkSeedsImage.h.

float mitk::SeedsImage::delta_y [protected]

Definition at line 84 of file mitkSeedsImage.h.

float mitk::SeedsImage::delta_z [protected]

Definition at line 84 of file mitkSeedsImage.h.

Definition at line 82 of file mitkSeedsImage.h.

GaussianFunction2DType::Pointer mitk::SeedsImage::m_GaussianFunction2D [protected]

Definition at line 92 of file mitkSeedsImage.h.

Referenced by SeedsImage().

GaussianFunction3DType::Pointer mitk::SeedsImage::m_GaussianFunction3D [protected]

Definition at line 90 of file mitkSeedsImage.h.

Referenced by SeedsImage().

mitk::Point3D mitk::SeedsImage::m_LastPoint [protected]

Definition at line 79 of file mitkSeedsImage.h.

mitk::Point3D mitk::SeedsImage::m_Point [protected]

Definition at line 78 of file mitkSeedsImage.h.

int mitk::SeedsImage::m_Radius [protected]

Definition at line 83 of file mitkSeedsImage.h.

mitk::Vector3D mitk::SeedsImage::m_Spacing [protected]

Definition at line 80 of file mitkSeedsImage.h.

Definition at line 97 of file mitkSeedsImage.h.

Definition at line 95 of file mitkSeedsImage.h.

int mitk::SeedsImage::orig_size[3] [protected]

Definition at line 81 of file mitkSeedsImage.h.

Definition at line 85 of file mitkSeedsImage.h.


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