#include <mitkBoundingObjectToSegmentationFilter.h>
Public Types | |
typedef BoundingObjectToSegmentationFilter | Self |
typedef ImageToImageFilter | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
virtual const char * | GetClassName () const |
void | SetBoundingObject (mitk::BoundingObject::Pointer boundingObject) |
Static Public Member Functions | |
static Pointer | New () |
Protected Member Functions | |
BoundingObjectToSegmentationFilter () | |
virtual | ~BoundingObjectToSegmentationFilter () |
virtual void | GenerateData () |
A version of GenerateData() specific for image processing filters. | |
Protected Attributes | |
mitk::BoundingObjectGroup::Pointer | m_boundingObjectGroup |
Definition at line 8 of file mitkBoundingObjectToSegmentationFilter.h.
typedef itk::SmartPointer<const Self> mitk::BoundingObjectToSegmentationFilter::ConstPointer |
Definition at line 11 of file mitkBoundingObjectToSegmentationFilter.h.
typedef itk::SmartPointer<Self> mitk::BoundingObjectToSegmentationFilter::Pointer |
Definition at line 11 of file mitkBoundingObjectToSegmentationFilter.h.
Definition at line 11 of file mitkBoundingObjectToSegmentationFilter.h.
Definition at line 11 of file mitkBoundingObjectToSegmentationFilter.h.
mitk::BoundingObjectToSegmentationFilter::BoundingObjectToSegmentationFilter | ( | ) | [protected] |
Definition at line 4 of file mitkBoundingObjectToSegmentationFilter.cpp.
{ this->SetNumberOfRequiredInputs(1); }
mitk::BoundingObjectToSegmentationFilter::~BoundingObjectToSegmentationFilter | ( | ) | [protected, virtual] |
Definition at line 10 of file mitkBoundingObjectToSegmentationFilter.cpp.
{ }
void mitk::BoundingObjectToSegmentationFilter::GenerateData | ( | ) | [protected, virtual] |
A version of GenerateData() specific for image processing filters.
This implementation will split the processing across multiple threads. The buffer is allocated by this method. Then the BeforeThreadedGenerateData() method is called (if provided). Then, a series of threads are spawned each calling ThreadedGenerateData(). After all the threads have completed processing, the AfterThreadedGenerateData() method is called (if provided). If an image processing filter cannot be threaded, the filter should provide an implementation of GenerateData(). That implementation is responsible for allocating the output buffer. If a filter an be threaded, it should NOT provide a GenerateData() method but should provide a ThreadedGenerateData() instead.
Reimplemented from mitk::ImageSource.
Definition at line 27 of file mitkBoundingObjectToSegmentationFilter.cpp.
References mitk::Geometry3D::CalculateBoundingBoxRelativeToTransform(), mitk::CastToItkImage(), mitk::CastToMitkImage(), mitk::BaseData::GetGeometry(), mitk::Geometry3D::GetIndexToWorldTransform(), mitk::BoundingObject::GetPositive(), mitk::Geometry3D::IndexToWorld(), mitk::Image::Initialize(), mitk::BoundingObject::IsInside(), QuadProgPP::max(), and min.
{ typedef itk::Image<unsigned char, 3> itkImageType; mitk::Image::Pointer outputImage = this->GetOutput(); mitk::Image::Pointer inputImage = const_cast<mitk::Image*> (this->GetInput()); outputImage->Initialize(this->GetInput()); itkImageType::Pointer itkImage; CastToItkImage(outputImage, itkImage); itkImage->FillBuffer(0); for (unsigned int i=0; i<m_boundingObjectGroup->GetCount(); i++) { //create region for boundingobject mitk::BoundingObject* boundingObject = m_boundingObjectGroup->GetBoundingObjects().at(i); mitk::Geometry3D* boGeometry = boundingObject->GetGeometry(); mitk::Geometry3D* inputImageGeometry = inputImage->GetSlicedGeometry(); mitk::BoundingBox::Pointer boToIm = boGeometry->CalculateBoundingBoxRelativeToTransform(inputImageGeometry->GetIndexToWorldTransform()); itkImageType::IndexType boIndex; mitk::BoundingBox::PointType min = boToIm->GetMinimum(); boIndex[0] = (mitk::SlicedData::IndexType::IndexValueType)(min[0]); boIndex[1] = (mitk::SlicedData::IndexType::IndexValueType)(min[1]); boIndex[2] = (mitk::SlicedData::IndexType::IndexValueType)(min[2]); itkImageType::SizeType boSize; mitk::BoundingBox::PointType max = boToIm->GetMaximum(); boSize[0] = (mitk::SlicedData::IndexType::IndexValueType) (max[0]-min[0]+1); boSize[1] = (mitk::SlicedData::IndexType::IndexValueType) (max[1]-min[1]+1); boSize[2] = (mitk::SlicedData::IndexType::IndexValueType) (max[2]-min[2]+1); itkImageType::RegionType region(boIndex, boSize); //create region iterator itk::ImageRegionIteratorWithIndex<itkImageType> itBoundingObject = itk::ImageRegionIteratorWithIndex<itkImageType>(itkImage, region ); itBoundingObject.GoToBegin(); while(!itBoundingObject.IsAtEnd()) { itkImageType::IndexType index = itBoundingObject.GetIndex(); mitk::Point3D p; p[0] = index[0]; p[1] = index[1]; p[2] = index[2]; inputImageGeometry->IndexToWorld(p,p); if (boundingObject->IsInside(p) && boundingObject->GetPositive()) itBoundingObject.Set(1); else if (boundingObject->IsInside(p) && !boundingObject->GetPositive()) itBoundingObject.Set(0); ++itBoundingObject; } } CastToMitkImage(itkImage, outputImage); }
virtual const char* mitk::BoundingObjectToSegmentationFilter::GetClassName | ( | ) | const [virtual] |
static Pointer mitk::BoundingObjectToSegmentationFilter::New | ( | ) | [static] |
Method for creation through the object factory.
Reimplemented from mitk::ImageToImageFilter.
Referenced by mitk::MorphologicTool::OnRoiDataChanged(), mitk::BinaryThresholdULTool::OnRoiDataChanged(), and mitk::BinaryThresholdTool::OnRoiDataChanged().
void mitk::BoundingObjectToSegmentationFilter::SetBoundingObject | ( | mitk::BoundingObject::Pointer | boundingObject ) |
Definition at line 15 of file mitkBoundingObjectToSegmentationFilter.cpp.
References mitk::BoundingObjectGroup::New().
{ mitk::BoundingObjectGroup* testgroup = dynamic_cast<mitk::BoundingObjectGroup*> (boundingObject.GetPointer()); if (testgroup) m_boundingObjectGroup = testgroup; else { m_boundingObjectGroup = mitk::BoundingObjectGroup::New(); m_boundingObjectGroup->AddBoundingObject(boundingObject); } }
mitk::BoundingObjectGroup::Pointer mitk::BoundingObjectToSegmentationFilter::m_boundingObjectGroup [protected] |
Definition at line 21 of file mitkBoundingObjectToSegmentationFilter.h.