#include <mitkAngleCorrectByPointFilter.h>
Public Types | |
typedef AngleCorrectByPointFilter | Self |
typedef ImageToImageFilter | Superclass |
typedef itk::SmartPointer< Self > | Pointer |
typedef itk::SmartPointer < const Self > | ConstPointer |
Public Member Functions | |
virtual const char * | GetClassName () const |
virtual void | SetCenter (Point3D _arg) |
virtual const Point3D & | GetCenter () |
virtual void | SetTransducerPosition (Point3D _arg) |
virtual const Point3D & | GetTransducerPosition () |
virtual void | SetPreferTransducerPositionFromProperty (bool _arg) |
virtual bool | GetPreferTransducerPositionFromProperty () |
Static Public Member Functions | |
static Pointer | New () |
Protected Member Functions | |
AngleCorrectByPointFilter () | |
~AngleCorrectByPointFilter () | |
virtual void | GenerateData () |
A version of GenerateData() specific for image processing filters. | |
virtual void | GenerateOutputInformation () |
virtual void | GenerateInputRequestedRegion () |
Protected Attributes | |
itk::TimeStamp | m_TimeOfHeaderInitialization |
Point3D | m_TransducerPosition |
Point3D | m_Center |
bool | m_PreferTransducerPositionFromProperty |
Definition at line 32 of file mitkAngleCorrectByPointFilter.h.
typedef itk::SmartPointer<const Self> mitk::AngleCorrectByPointFilter::ConstPointer |
Definition at line 35 of file mitkAngleCorrectByPointFilter.h.
typedef itk::SmartPointer<Self> mitk::AngleCorrectByPointFilter::Pointer |
Definition at line 35 of file mitkAngleCorrectByPointFilter.h.
Definition at line 35 of file mitkAngleCorrectByPointFilter.h.
Definition at line 35 of file mitkAngleCorrectByPointFilter.h.
mitk::AngleCorrectByPointFilter::AngleCorrectByPointFilter | ( | ) | [protected] |
Definition at line 23 of file mitkAngleCorrectByPointFilter.cpp.
References m_Center, and m_TransducerPosition.
: m_PreferTransducerPositionFromProperty(true) { m_Center.Fill(0); m_TransducerPosition.Fill(0); }
mitk::AngleCorrectByPointFilter::~AngleCorrectByPointFilter | ( | ) | [protected] |
Definition at line 29 of file mitkAngleCorrectByPointFilter.cpp.
{ }
void mitk::AngleCorrectByPointFilter::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 74 of file mitkAngleCorrectByPointFilter.cpp.
References mitk::GenericProperty< T >::GetValue(), mitkIpPicDescriptor, mitk::ImageTimeSelector::New(), and QuadProgPP::t().
{ mitk::Image::ConstPointer input = this->GetInput(); mitk::Image::Pointer output = this->GetOutput(); if(m_PreferTransducerPositionFromProperty) { mitk::Point3iProperty::Pointer pointProp; pointProp = dynamic_cast<mitk::Point3iProperty*>(input->GetProperty("ORIGIN").GetPointer()); if (pointProp.IsNotNull() ) { const itk::Point<int, 3> & p = pointProp->GetValue(); m_TransducerPosition[0] = p[0]; m_TransducerPosition[1] = p[1]; m_TransducerPosition[2] = p[2]; } } itkDebugMacro( << "compute angle corrected image .... " ); itkDebugMacro( << " Center[0]=" << m_Center[0] << " Center[1]=" << m_Center[1] << " Center[2]=" << m_Center[2] ); itkDebugMacro( << " TransducerPosition[0]=" << m_TransducerPosition[0] << " TransducerPosition[1]=" << m_TransducerPosition[1] << " TransducerPosition[2]=" << m_TransducerPosition[2] ); const Vector3D & spacing = input->GetSlicedGeometry()->GetSpacing(); // MITK_INFO << " in: xres=" << spacing[0] << " yres=" << spacing[1] << " zres=" << spacing[2] << std::endl; if((spacing[0]!=spacing[1]) || (spacing[0]!=spacing[2])) { itkExceptionMacro("filter does not work for uninsotropic data: spacing: ("<< spacing[0] << "," << spacing[1] << "," << spacing[2] << ")"); } Vector3D p; Vector3D tx_direction; Vector3D tx_position = m_TransducerPosition.GetVectorFromOrigin(); Vector3D center = m_Center.GetVectorFromOrigin(); Vector3D assumed_direction; ScalarType &x=p[0]; ScalarType &y=p[1]; ScalarType &z=p[2]; Vector3D down; FillVector3D(down,0.0,0.0,-1.0); int xDim = input->GetDimension(0); int yDim = input->GetDimension(1); int zDim = input->GetDimension(2); mitkIpPicDescriptor* pic_out; pic_out = mitkIpPicNew(); pic_out->dim = 3; pic_out->bpe = output->GetPixelType().GetBpe(); pic_out->type = output->GetPixelType().GetType(); pic_out->n[0] = xDim; pic_out->n[1] = yDim; pic_out->n[2] = zDim; pic_out->data = malloc(_mitkIpPicSize(pic_out)); //go! mitk::ImageTimeSelector::Pointer timeSelector=mitk::ImageTimeSelector::New(); timeSelector->SetInput(input); int nstart, nmax; int tstart, tmax; tstart=output->GetRequestedRegion().GetIndex(3); nstart=output->GetRequestedRegion().GetIndex(4); tmax=tstart+output->GetRequestedRegion().GetSize(3); nmax=nstart+output->GetRequestedRegion().GetSize(4); int n,t; for(n=nstart;n<nmax;++n)//output->GetNumberOfChannels();++n) { timeSelector->SetChannelNr(n); for(t=tstart;t<tmax;++t) { timeSelector->SetTimeNr(t); timeSelector->Update(); typedef unsigned char InputImagePixelType; typedef ScalarType OutputImagePixelType; if(*input->GetPixelType().GetTypeId()!=typeid(InputImagePixelType)) { itkExceptionMacro("only implemented for " << typeid(PixelType).name() ); } InputImagePixelType *in; OutputImagePixelType *out; in = (InputImagePixelType *)timeSelector->GetOutput()->GetData(); out = (OutputImagePixelType*)pic_out->data; for (z=0 ; z<zDim ; ++z) { for (y=0; y<yDim; ++y) { for (x=0; x<xDim; ++x, ++in, ++out) { tx_direction = tx_position-p; tx_direction.Normalize(); //are we within the acquisition cone? // if(-tx_direction*down>vnl_math::pi_over_4) { assumed_direction = center-p; assumed_direction.Normalize(); ScalarType cos_factor = tx_direction*assumed_direction; if(fabs(cos_factor)>eps) *out=((ScalarType)(*in)-128.0)/cos_factor; else *out=((ScalarType)(*in)-128.0)/eps; } //else // *out=0; } } } output->SetPicVolume(pic_out, t, n); } } }
void mitk::AngleCorrectByPointFilter::GenerateInputRequestedRegion | ( | ) | [protected, virtual] |
What is the input requested region that is required to produce the output requested region? The base assumption for image processing filters is that the input requested region can be set to match the output requested region. If a filter requires more input (for instance a filter that uses neighborhoods needs more input than output to avoid introducing artificial boundary conditions) or less input (for instance a magnify filter) will have to override this method. In doing so, it should call its superclass' implementation as its first step. Note that this imaging filters operate differently than the classes to this point in the class hierachy. Up till now, the base assumption has been that the largest possible region will be requested of the input.
Reimplemented from mitk::ImageToImageFilter.
Definition at line 199 of file mitkAngleCorrectByPointFilter.cpp.
{ Superclass::GenerateInputRequestedRegion(); mitk::ImageToImageFilter::InputImagePointer input = const_cast< mitk::ImageToImageFilter::InputImageType * > ( this->GetInput() ); mitk::Image::Pointer output = this->GetOutput(); Image::RegionType requestedRegion; requestedRegion = output->GetRequestedRegion(); requestedRegion.SetIndex(0, 0); requestedRegion.SetIndex(1, 0); requestedRegion.SetIndex(2, 0); //requestedRegion.SetIndex(3, 0); //requestedRegion.SetIndex(4, 0); requestedRegion.SetSize(0, input->GetDimension(0)); requestedRegion.SetSize(1, input->GetDimension(1)); requestedRegion.SetSize(2, input->GetDimension(2)); //requestedRegion.SetSize(3, output->GetDimension(3)); //requestedRegion.SetSize(4, output->GetNumberOfChannels()); input->SetRequestedRegion( & requestedRegion ); }
void mitk::AngleCorrectByPointFilter::GenerateOutputInformation | ( | void | ) | [protected, virtual] |
Definition at line 34 of file mitkAngleCorrectByPointFilter.cpp.
{ mitk::Image::ConstPointer input = this->GetInput(); mitk::Image::Pointer output = this->GetOutput(); if ((output->IsInitialized()) && (this->GetMTime() <= m_TimeOfHeaderInitialization.GetMTime())) return; itkDebugMacro(<<"GenerateOutputInformation()"); unsigned int i; unsigned int *tmpDimensions = new unsigned int[input->GetDimension()]; for(i=0;i<input->GetDimension();++i) tmpDimensions[i]=input->GetDimension(i); //@todo maybe we should shift the following somehow in ImageToImageFilter output->Initialize(PixelType(typeid(ScalarType)), input->GetDimension(), tmpDimensions, input->GetNumberOfChannels()); output->GetSlicedGeometry()->SetSpacing(input->GetSlicedGeometry()->GetSpacing()); //output->GetSlicedGeometry()->SetGeometry2D(mitk::Image::BuildStandardPlaneGeometry2D(output->GetSlicedGeometry(), tmpDimensions).GetPointer(), 0); //output->GetSlicedGeometry()->SetEvenlySpaced(); //set the timebounds - after SetGeometry2D, so that the already created PlaneGeometry will also receive this timebounds. //@fixme!!! will not work for not evenly timed data! output->GetSlicedGeometry()->SetTimeBounds(input->GetSlicedGeometry()->GetTimeBounds()); output->GetTimeSlicedGeometry()->InitializeEvenlyTimed(output->GetSlicedGeometry(), output->GetTimeSlicedGeometry()->GetTimeSteps()); output->SetPropertyList(input->GetPropertyList()->Clone()); delete [] tmpDimensions; m_TimeOfHeaderInitialization.Modified(); }
virtual const Point3D& mitk::AngleCorrectByPointFilter::GetCenter | ( | ) | [virtual] |
virtual const char* mitk::AngleCorrectByPointFilter::GetClassName | ( | ) | const [virtual] |
virtual bool mitk::AngleCorrectByPointFilter::GetPreferTransducerPositionFromProperty | ( | ) | [virtual] |
virtual const Point3D& mitk::AngleCorrectByPointFilter::GetTransducerPosition | ( | ) | [virtual] |
static Pointer mitk::AngleCorrectByPointFilter::New | ( | ) | [static] |
Method for creation through the object factory.
Reimplemented from mitk::ImageToImageFilter.
virtual void mitk::AngleCorrectByPointFilter::SetCenter | ( | Point3D | _arg ) | [virtual] |
virtual void mitk::AngleCorrectByPointFilter::SetPreferTransducerPositionFromProperty | ( | bool | _arg ) | [virtual] |
virtual void mitk::AngleCorrectByPointFilter::SetTransducerPosition | ( | Point3D | _arg ) | [virtual] |
Point3D mitk::AngleCorrectByPointFilter::m_Center [protected] |
Definition at line 66 of file mitkAngleCorrectByPointFilter.h.
Referenced by AngleCorrectByPointFilter().
Definition at line 68 of file mitkAngleCorrectByPointFilter.h.
itk::TimeStamp mitk::AngleCorrectByPointFilter::m_TimeOfHeaderInitialization [protected] |
Definition at line 46 of file mitkAngleCorrectByPointFilter.h.
Point3D mitk::AngleCorrectByPointFilter::m_TransducerPosition [protected] |
Definition at line 65 of file mitkAngleCorrectByPointFilter.h.
Referenced by AngleCorrectByPointFilter().