本文整理汇总了C++中mitk::image::Pointer::GetGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ Pointer::GetGeometry方法的具体用法?C++ Pointer::GetGeometry怎么用?C++ Pointer::GetGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mitk::image::Pointer
的用法示例。
在下文中一共展示了Pointer::GetGeometry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool mitk::SurfaceInterpolationController::ReplaceInterpolationSession(mitk::Image::Pointer oldSession, mitk::Image::Pointer newSession)
{
if (oldSession.IsNull() || newSession.IsNull())
return false;
if (oldSession.GetPointer() == newSession.GetPointer())
return false;
if (!mitk::Equal(*(oldSession->GetGeometry()), *(newSession->GetGeometry()), mitk::eps, false))
return false;
auto it = m_ListOfInterpolationSessions.find(oldSession.GetPointer());
if (it == m_ListOfInterpolationSessions.end())
return false;
ContourPositionInformationVec2D oldList = (*it).second;
m_ListOfInterpolationSessions.insert(std::pair<mitk::Image*, ContourPositionInformationVec2D>(newSession.GetPointer(), oldList));
itk::MemberCommand<SurfaceInterpolationController>::Pointer command = itk::MemberCommand<SurfaceInterpolationController>::New();
command->SetCallbackFunction(this, &SurfaceInterpolationController::OnSegmentationDeleted);
m_SegmentationObserverTags.insert( std::pair<mitk::Image*, unsigned long>( newSession, newSession->AddObserver( itk::DeleteEvent(), command ) ) );
if (m_SelectedSegmentation == oldSession)
m_SelectedSegmentation = newSession;
mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
timeSelector->SetInput( m_SelectedSegmentation );
timeSelector->SetTimeNr( m_CurrentTimeStep );
timeSelector->SetChannelNr( 0 );
timeSelector->Update();
mitk::Image::Pointer refSegImage = timeSelector->GetOutput();
m_NormalsFilter->SetSegmentationBinaryImage(refSegImage);
this->RemoveInterpolationSession(oldSession);
return true;
}
示例2: ConvertToRGBImage
/**
* @brief ConvertToRGBImage converts a gray image to RGB by filling all three channels with the gray intensity
* @param grayImage
* @return
*/
mitk::Image::Pointer ConvertToRGBImage(mitk::Image::Pointer grayImage)
{
mitk::Image::Pointer rgbImage = mitk::Image::New();
unsigned int *dim = grayImage->GetDimensions();
rgbImage->Initialize(mitk::MakePixelType<PixelType, RGBPixelType,3>(),3,dim);
rgbImage->SetGeometry(grayImage->GetGeometry());
itk::Image<InputPixelType,3>::Pointer itkGrayImage = itk::Image<InputPixelType,3>::New();
mitk::CastToItkImage(grayImage, itkGrayImage);
mitk::ImagePixelWriteAccessor<RGBPixelType,3> writeAcc(rgbImage);
typedef itk::RescaleIntensityImageFilter< itk::Image<InputPixelType,3>, itk::Image<PixelType,3> > RescaleFilterType;
RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New();
rescaleFilter->SetInput(itkGrayImage);
rescaleFilter->SetOutputMinimum(0);
rescaleFilter->SetOutputMaximum(255*255);
rescaleFilter->Update();
itk::Index<3> idx;
RGBPixelType value;
// Fill rgb image with gray values
for (idx[2] =0; (unsigned int)idx[2] < dim[2]; idx[2]++)
{
for (idx[1] =0; (unsigned int)idx[1] < dim[1]; idx[1]++)
{
for (idx[0] =0; (unsigned int)idx[0] < dim[0]; idx[0]++)
{
value.Fill(rescaleFilter->GetOutput()->GetPixel(idx));
writeAcc.SetPixelByIndex(idx, value);
}
}
}
return rgbImage;
}
示例3: ConvertToItk
Float4DImageType::Pointer QmitkTbssSkeletonizationView::ConvertToItk(mitk::Image::Pointer image)
{
Float4DImageType::Pointer output = Float4DImageType::New();
mitk::Geometry3D* geo = image->GetGeometry();
mitk::Vector3D mitkSpacing = geo->GetSpacing();
mitk::Point3D mitkOrigin = geo->GetOrigin();
Float4DImageType::SpacingType spacing;
spacing[0] = mitkSpacing[0];
spacing[1] = mitkSpacing[1];
spacing[2] = mitkSpacing[2];
spacing[3] = 1.0; // todo: check if spacing has length 4
Float4DImageType::PointType origin;
origin[0] = mitkOrigin[0];
origin[1] = mitkOrigin[1];
origin[2] = mitkOrigin[2];
origin[3] = 0;
Float4DImageType::SizeType size;
size[0] = image->GetDimension(0);
size[1] = image->GetDimension(1);
size[2] = image->GetDimension(2);
size[3] = image->GetDimension(3);
Float4DImageType::DirectionType dir;
vtkLinearTransform* lin = geo->GetVtkTransform();
vtkMatrix4x4 *m = lin->GetMatrix();
dir.Fill(0.0);
for(int x=0; x<3; x++)
{
for(int y=0; y<3; y++)
{
dir[x][y] = m->GetElement(x,y);
}
}
dir[3][3] = 1;
output->SetSpacing(spacing);
output->SetOrigin(origin);
output->SetRegions(size);
output->SetDirection(dir);
output->Allocate();
if(image->GetDimension() == 4)
{
int timesteps = image->GetDimension(3);
try{
// REPLACE THIS METHODE()ConvertToItk) WITH mitk::CastToItk
// iterate through the subjects and copy data to output
for(int t=0; t<timesteps; t++)
{
for(int x=0; x<image->GetDimension(0); x++)
{
for(int y=0; y<image->GetDimension(1); y++)
{
for(int z=0; z<image->GetDimension(2); z++)
{
itk::Index<3> ix = {x, y, z};
itk::Index<4> ix4 = {x, y, z, t};
output->SetPixel(ix4, image->GetPixelValueByIndex(ix, t));
}
}
}
}
}
catch(std::exception & e)
{
MITK_INFO << e.what();
}
}
return output;
}