当前位置:网站首页>Index changes of seed points in ITK original image after ROI and downsampling
Index changes of seed points in ITK original image after ROI and downsampling
2022-06-12 12:41:00 【April 16!】
Original image in vtk Physical coordinates and index Sort out the relationship between :
1、vtk Interaction : stay vtk From the slice world point, use Image->TransformPhysicalPointToIndex(worldpoint) Function can be used to get the index;
2、ITk At the same position of the image index Extracting ROI Area and Downsampling What will become after ? How to calculate ?
The following functions are extracted by me ROI Area , Then on ROI Code for area downsampling :
#include "itkRegionOfInterestImageFilter.h"
#include "itkResampleImageFilter.h"
template <typename ImageType>
void getROIandReshampe(ImageType* inputImage,ImageType* outputImage)
{
auto size = inputImage->GetLargestPossibleRegion().GetSize();
typedef itk::RegionOfInterestImageFilter<ImageType,ImageType> FilterType;
FilterType::Pointer roi = FilterType::New();
ImageType::IndexType start;
start[0] = 50;
start[1] = 50;
start[2] = 10;
ImageType::SizeType roiSize;
roiSize[0] = 200;
roiSize[1] = 240;
roiSize[2] = 90;
ImageType::RegionType desiredRegion;
desiredRegion.SetSize(roiSize);
desiredRegion.SetIndex(start);
roi->SetRegionOfInterest(desiredRegion);
roi->SetInput(inputImage);
roi->Update();
auto spacing = inputImage->GetSpacing();
int a = 5;
spacing[0] = a;
spacing[1] = a;
spacing[2] = a;
typedef itk::ResampleImageFilter<ImageType,ImageType> ResampleImageFilterType;
ResampleImageFilterType::Pointer resampleFilter = ResampleImageFilterType::New();
resampleFilter->SetInput(inputImage);
typedef itk::NearestNeighborInterpolateImageFunction<ImageType, double> InterpolatorType;
InterpolatorType::Pointer interpolator = InterpolatorType::New();
resampleFilter->SetInterpolator(interpolator);
resampleFilter->SetDefaultPixelValue(0);
resampleFilter->SetOutputSpacing(spacing);
resampleFilter->SetSize(inputImage->GetLargestPossibleRegion().GetSize());
resampleFilter->SetOutputOrigin(inputImage->GetOrigin());
resampleFilter->SetOutputDirection(inputImage->GetDirection());
resampleFilter->Update();
outputImage = resampleFilter->GetOutput();
}
a key :
itk Of ROI Function to get the image size Same as the original drawing size The same big as that , therefore ROI In the same position index No change ;
for example : A seed dot in the original picture index by :p : [px,py,pz]
ROI This point is included in ROI In the region : hypothesis ROI The starting point of index by ROIstart, The size of the area is ROISize
Seeded index Still :[px,py,pz]
After downsampling : The size of the whole physical space of the obtained image has not changed , change spacing after , The physical location at the same pixel location ( World coordinates ) Same as the original , however index atypism , Because of the new spacing After getting bigger , The position between pixels becomes larger ,
p It's from the original index;
spacing、origin Is the parameter of the original drawing ;
space Is the parameter of downsampling ;
So the seed order index Turn into :
shampleIndex[0] = ((px - start[0]) * spacing[0] + origin[0]) / space[0];
shampleIndex[1] = ((py - start[1]) * spacing[1] + origin[1]) / space[1];
shampleIndex[2] = ((pz - start[2]) * spacing[2] + origin[2]) / space[2];
At this point, the seed points of the original graph are obtained index In the downsampled image Of index
Revision summary
边栏推荐
- Differences and recommended uses of VaR, let and const (interview)
- Point cloud registration -- GICP principle and its application in PCL
- vtk 图像序列鼠标交互翻页
- Async/await for ES6
- 八大误区,逐个击破(2):性能差?应用程序少?你对云的这些担心很多余!
- 【vim】vim插件YouCompleteMe配置文件
- LDAP和SSO集成能实现什么效果?
- ITK Examples/RegistrationITKv4/DeformableRegistration
- Vim,Gcc,Gdb
- itk::Neighborhood获取6邻域、18邻域、26邻域,18/6邻域,26/18邻域
猜你喜欢

Point cloud registration -- GICP principle and its application in PCL

Async/await for ES6

安全KNN
![[C language] keyword static & Multi file & guessing game](/img/82/fa3556522531f83e95938fc4efbf1e.png)
[C language] keyword static & Multi file & guessing game

Influxdb2.x benchmark tool - influxdb comparisons

元宇宙是短炒,还是未来趋势?

数组——双指针技巧秒杀七道数组题目

Reasons for college students' leave

A "murder case" caused by ES setting operation

Rust language learning
随机推荐
Difference between Definition and Declaration
牛顿法解多项式的根
itk::SymmetricForcesDemonsRegistrationFilter
NewOJ Week 10题解
Tuples, arrays, and as const of typescript
In depth anatomy of C language - key words & supplementary contents
Deep analysis of advanced pointer -- advanced chapter of C language
Numpy数值计算基础
Soft test network engineer notes
点云配准--gicp原理与其在pcl中的使用
2021-11-16
Principle of master-slave replication of redis
MySQL 分区表介绍与测试
VNCTF2022 [WEB]
Binary tree (program)
Binary tree (serialization)
A short guide to SSH port forwarding
SEO optimization of web pages
vtk 三视图
Problems encountered in installing canvas and errors encountered in running the project