本文整理汇总了C++中image::Pointer::GetRequestedRegion方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetRequestedRegion方法的具体用法?C++ Pointer::GetRequestedRegion怎么用?C++ Pointer::GetRequestedRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image::Pointer
的用法示例。
在下文中一共展示了Pointer::GetRequestedRegion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void mitk::GeometryClipImageFilter::GenerateData()
{
Image::ConstPointer input = this->GetInput();
Image::Pointer output = this->GetOutput();
if((output->IsInitialized()==false) || (m_ClippingGeometry.IsNull()))
return;
const Geometry2D * clippingGeometryOfCurrentTimeStep = NULL;
if(m_TimeSlicedClippingGeometry.IsNull())
{
clippingGeometryOfCurrentTimeStep = dynamic_cast<const Geometry2D*>(m_ClippingGeometry.GetPointer());
}
else
{
clippingGeometryOfCurrentTimeStep = dynamic_cast<const Geometry2D*>(m_TimeSlicedClippingGeometry->GetGeometry3D(0));
}
if(clippingGeometryOfCurrentTimeStep == NULL)
return;
m_InputTimeSelector->SetInput(input);
m_OutputTimeSelector->SetInput(this->GetOutput());
mitk::Image::RegionType outputRegion = output->GetRequestedRegion();
const mitk::TimeSlicedGeometry *outputTimeGeometry = output->GetTimeSlicedGeometry();
const mitk::TimeSlicedGeometry *inputTimeGeometry = input->GetTimeSlicedGeometry();
ScalarType timeInMS;
int timestep=0;
int tstart=outputRegion.GetIndex(3);
int tmax=tstart+outputRegion.GetSize(3);
int t;
for(t=tstart;t<tmax;++t)
{
timeInMS = outputTimeGeometry->TimeStepToMS( t );
timestep = inputTimeGeometry->MSToTimeStep( timeInMS );
m_InputTimeSelector->SetTimeNr(timestep);
m_InputTimeSelector->UpdateLargestPossibleRegion();
m_OutputTimeSelector->SetTimeNr(t);
m_OutputTimeSelector->UpdateLargestPossibleRegion();
if(m_TimeSlicedClippingGeometry.IsNotNull())
{
timestep = m_TimeSlicedClippingGeometry->MSToTimeStep( timeInMS );
if(m_TimeSlicedClippingGeometry->IsValidTime(timestep) == false)
continue;
clippingGeometryOfCurrentTimeStep = dynamic_cast<const Geometry2D*>(m_TimeSlicedClippingGeometry->GetGeometry3D(timestep));
}
AccessByItk_2(m_InputTimeSelector->GetOutput(),_InternalComputeClippedImage,this,clippingGeometryOfCurrentTimeStep);
}
m_TimeOfHeaderInitialization.Modified();
}
示例2:
/*
* What is the input requested region that is required to produce the output
* requested region? By default, the largest possible region is always
* required but this is overridden in many subclasses. For instance, for an
* image processing filter where an output pixel is a simple function of an
* input pixel, the input requested region will be set to the output
* requested region. For an image processing filter where an output pixel is
* a function of the pixels in a neighborhood of an input pixel, then the
* input requested region will need to be larger than the output requested
* region (to avoid introducing artificial boundary conditions). This
* function should never request an input region that is outside the the
* input largest possible region (i.e. implementations of this method should
* crop the input requested region at the boundaries of the input largest
* possible region).
*/
void mitk::ExtractImageFilter::GenerateInputRequestedRegion()
{
Superclass::GenerateInputRequestedRegion();
ImageToImageFilter::InputImagePointer input = const_cast< ImageToImageFilter::InputImageType* > ( this->GetInput() );
Image::Pointer output = this->GetOutput();
if (input->GetDimension() == 2)
{
input->SetRequestedRegionToLargestPossibleRegion();
return;
}
Image::RegionType requestedRegion;
requestedRegion = output->GetRequestedRegion();
requestedRegion.SetIndex(0, 0);
requestedRegion.SetIndex(1, 0);
requestedRegion.SetIndex(2, 0);
requestedRegion.SetSize(0, input->GetDimension(0));
requestedRegion.SetSize(1, input->GetDimension(1));
requestedRegion.SetSize(2, input->GetDimension(2));
requestedRegion.SetIndex( m_SliceDimension, m_SliceIndex ); // only one slice needed
requestedRegion.SetSize( m_SliceDimension, 1 );
input->SetRequestedRegion( &requestedRegion );
}
示例3:
void mitk::ImageTimeSelector::GenerateInputRequestedRegion()
{
Superclass::GenerateInputRequestedRegion();
ImageToImageFilter::InputImagePointer input =
const_cast< mitk::ImageToImageFilter::InputImageType * > ( this->GetInput() );
Image::Pointer output = this->GetOutput();
Image::RegionType requestedRegion;
requestedRegion = output->GetRequestedRegion();
requestedRegion.SetIndex(3, m_TimeNr);
requestedRegion.SetIndex(4, m_ChannelNr);
requestedRegion.SetSize(3, 1);
requestedRegion.SetSize(4, 1);
input->SetRequestedRegion( & requestedRegion );
}