当前位置:网站首页>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
边栏推荐
- A "murder case" caused by ES setting operation
- 2021-11-16
- This direction of ordinary function and arrow function
- Array -- fancy traversal technique of two-dimensional array
- 一个ES设置操作引发的“血案”
- TRON-api-波场转账查询接口-PHP版本-基于ThinkPHP5封装-附带接口文档-20220602版本-接口部署好适用于任何开发语言
- 关于派文的问题
- AND THE BIT GOES DOWN: REVISITING THE QUANTIZATION OF NEURAL NETWORKS
- Boot entry directory
- itk 多分辨率图像 itk::RecursiveMultiResolutionPyramidImageFilter
猜你喜欢

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

NewOJ Week 10题解
![[HXBCTF 2021]easywill](/img/a2/8bf7d78fccf0d365490a84a8a9883d.jpg)
[HXBCTF 2021]easywill

数组——二维数组的花式遍历技巧

Downloading and using SWI Prolog

【您编码,我修复】WhiteSource正式更名为Mend

Binary tree (program)

C语言进阶篇——浮点型在内存中的存储

VGg small convolution instead of large convolution vs deep separable convolution

Dasctf Sept x Zhejiang University of technology autumn challenge Web
随机推荐
vtk 图像序列鼠标交互翻页
MySQL 分区表介绍与测试
分享PDF高清版,系列篇
元宇宙是短炒,还是未来趋势?
Vim,Gcc,Gdb
Array -- fancy traversal technique of two-dimensional array
AND THE BIT GOES DOWN: REVISITING THE QUANTIZATION OF NEURAL NETWORKS
JS string array converted to numeric array and how to add the numbers in the array
Dasctf Sept x Zhejiang University of technology autumn challenge Web
Array -- seven array topics with double pointer technique
轻量化---Project
Bat interview & advanced, get interview materials at the end of the text
Binary tree (construction)
A short guide to SSH port forwarding
JS attribute operation and node operation
2022 ARTS|Week 23
Vs2019 set ctrl+/ as shortcut key for annotation and uncomment
【数据库】navicat --oracle数据库创建
数组——双指针技巧秒杀七道数组题目
Point cloud registration -- GICP principle and its application in PCL