当前位置:网站首页>ITK multiresolution image itk:: recursivemultiresolutionpyramidimagefilter
ITK multiresolution image itk:: recursivemultiresolutionpyramidimagefilter
2022-06-12 12:41:00 【April 16!】
itk::RecursiveMultiResolutionPyramidImageFilter
Finally, multiple resolution images are obtained :

#include "itkImage.h"
#include "itkImageFileWriter.h"
#include "itkRescaleIntensityImageFilter.h"
#include "itkRecursiveMultiResolutionPyramidImageFilter.h"
using UnsignedCharImageType = itk::Image<unsigned char, 2>;
static void
CreateImage(UnsignedCharImageType::Pointer image);
int
main(int, char *[])
{
UnsignedCharImageType::Pointer image = UnsignedCharImageType::New();
CreateImage(image);
using FloatImageType = itk::Image<float, 2>;
unsigned int numberOfLevels = 4;
using RecursiveMultiResolutionPyramidImageFilterType =
itk::RecursiveMultiResolutionPyramidImageFilter<UnsignedCharImageType, FloatImageType>;
RecursiveMultiResolutionPyramidImageFilterType::Pointer recursiveMultiResolutionPyramidImageFilter =
RecursiveMultiResolutionPyramidImageFilterType::New();
recursiveMultiResolutionPyramidImageFilter->SetInput(image);
recursiveMultiResolutionPyramidImageFilter->SetNumberOfLevels(numberOfLevels);
recursiveMultiResolutionPyramidImageFilter->Update();
// This outputs the levels (0 is the lowest resolution)
for (unsigned int i = 0; i < numberOfLevels; ++i)
{
// Scale so we can write to a PNG
using RescaleFilterType = itk::RescaleIntensityImageFilter<FloatImageType, UnsignedCharImageType>;
RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New();
rescaleFilter->SetInput(recursiveMultiResolutionPyramidImageFilter->GetOutput(i));
rescaleFilter->SetOutputMinimum(0);
rescaleFilter->SetOutputMaximum(255);
rescaleFilter->Update();
using FileWriterType = itk::ImageFileWriter<UnsignedCharImageType>;
FileWriterType::Pointer writer = FileWriterType::New();
std::stringstream ss;
ss << "output_" << i << ".png";
std::cout << "Writing " << ss.str() << std::endl;
writer->SetFileName(ss.str());
writer->SetInput(rescaleFilter->GetOutput());
writer->Update();
}
return EXIT_SUCCESS;
}
void
CreateImage(UnsignedCharImageType::Pointer image)
{
// Create a black image with a white region
UnsignedCharImageType::IndexType start;
start.Fill(0);
UnsignedCharImageType::SizeType size;
size.Fill(200);
UnsignedCharImageType::RegionType region(start, size);
image->SetRegions(region);
image->Allocate();
image->FillBuffer(0);
// Make a square
for (unsigned int r = 20; r < 80; r++)
{
for (unsigned int c = 30; c < 100; c++)
{
UnsignedCharImageType::IndexType pixelIndex;
pixelIndex[0] = r;
pixelIndex[1] = c;
image->SetPixel(pixelIndex, 255);
}
}
}
边栏推荐
- Itk:: neighborhood get 6 neighborhood, 18 neighborhood, 26 neighborhood, 18/6 neighborhood, 26/18 neighborhood
- Image comparison function after registration itk:: checkerboardimagefilter
- Three dimensional coordinate point fitting sphere (MATLAB and C)
- vtk 图像序列鼠标交互翻页
- From simple to deep - websocket
- 功能标记是什么?一文了解它的作用,以及它的最佳实践
- Binary tree (thoughts)
- Binary tree (program)
- Object. Detailed explanation of assign()
- C语言进阶篇——浮点型在内存中的存储
猜你喜欢

Examples of Cartesian product and natural connection of relational algebra

什么时候运用二分搜索

Tuples, arrays, and as const of typescript
![[JS] some handwriting functions: deep copy, bind, debounce, etc](/img/f8/cf51a24450a88abb9e68c78e0e3aa8.jpg)
[JS] some handwriting functions: deep copy, bind, debounce, etc

itk 多分辨率图像 itk::RecursiveMultiResolutionPyramidImageFilter

Time series database - incluxdb2 docker installation

Matlab install license manager error -8

itk itk::BSplineDeformableTransform

Rust language learning

Iterator, generator generator details
随机推荐
号称下一代监控系统!来看看它有多牛逼
二叉树(纲领篇)
Reasons for college students' leave
AND THE BIT GOES DOWN: REVISITING THE QUANTIZATION OF NEURAL NETWORKS
Buu question brushing record - 6
Dom and BOM in JS
分享PDF高清版,系列篇
JS pre parsing, object, new keyword
八大误区,逐个击破(2):性能差?应用程序少?你对云的这些担心很多余!
深度剖析指针的进阶——C语言的进阶篇
Constant time delete / find any element in array
[C language] keyword static & Multi file & guessing game
OpenMAX (OMX)框架
【C语言】关键字static&&多文件&&猜字游戏
提升管道效率:你需要知道如何识别CI/CD管道中的主要障碍
Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference
2022 ARTS|Week 23
Advanced chapter of C language -- ten thousand words explanation pointer and qsort function
Binary tree (serialization)
Influxdb2.x benchmark tool - influxdb comparisons