当前位置:网站首页>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
边栏推荐
- 【C语言】关键字static&&多文件&&猜字游戏
- [HXBCTF 2021]easywill
- [C language] keyword static & Multi file & guessing game
- itk neighbhood
- 一个ES设置操作引发的“血案”
- 数组——双指针技巧秒杀七道数组题目
- Summary of knowledge points of ES6, ES7, es8, es9, ES10, es11 and ES12 (interview)
- 功能标记是什么?一文了解它的作用,以及它的最佳实践
- Brush questions [de1ctf 2019]shellshellshell
- 【VIM】.vimrc配置,已经安装Vundle,YoucompleteMe
猜你喜欢

Attack and defense world re (New 1 hand zone) questions 1-12

路由信息的来源

El select data echo, display only value but not label

InfluxDB2.x 基准测试工具 - influxdb-comparisons

一个ES设置操作引发的“血案”

Bat interview & advanced, get interview materials at the end of the text

Safety KNN

Array -- fancy traversal technique of two-dimensional array

Deep analysis of advanced pointer -- advanced chapter of C language

Advanced C language -- storage of floating point in memory
随机推荐
Start with Xiaobai, take the weight parameter from the trained model and draw the histogram
Summary of knowledge points of ES6, ES7, es8, es9, ES10, es11 and ES12 (interview)
Take the web page animation effects that can be used. Don't you come and have a look?
【VIM】.vimrc配置,已经安装Vundle,YoucompleteMe
What can LDAP and SSO integration achieve?
元宇宙是短炒,还是未来趋势?
Native JS implements the copy text function
Pre order, middle order and post order traversal of tree
Safety KNN
Vs2019 set ctrl+/ as shortcut key for annotation and uncomment
Binary tree (construction)
JS how to get the values of multiple objects in an array
You can't just use console Log ()?
InfluxDB2.x 基准测试工具 - influxdb-comparisons
Uniapp wechat applet long press the identification QR code to jump to applet and personal wechat
数组——双指针技巧秒杀七道数组题目
JS built in object
Typescript and abstract classes
wx. Login and wx Getuserprofile simultaneous use problem
Kdd2022 | edge information enhancement graph transformer