生成drr
char * input_name = "test.mhd";
char * output_name = "test.tif";
float rx = 90.;
float ry = 0.;
float rz = 90.;
float tx = 0.;
float ty = 0.;
float tz = 0.;
float cx = 0.;
float cy = 0.;
float cz = 0.;
float sid = 400.;
float sx = 0.5;
float sy = 0.5;
int dx = 501;
int dy = 501;
float o2Dx = 0;
float o2Dy = 0;
double threshold = 0;
constexpr unsigned int Dimension = 3;
using InputPixelType = short;
using OutputPixelType = unsigned char;
using InputImageType = itk::Image<InputPixelType, Dimension>;
using OutputImageType = itk::Image<OutputPixelType, Dimension>;
using OutputImageType2 = itk::Image<OutputPixelType, Dimension2D>;
InputImageType::Pointer image;
if(input_name){
std::string image3dPath = "D:\\ctdata\\spine\\spineL11.mhd";
using ReaderType = itk::ImageFileReader<InputImageType>;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(image3dPath);
using ImageIOType = itk::MetaImageIO;
ImageIOType::Pointer imageIO = ImageIOType::New();
reader->SetImageIO(imageIO);
reader->Update();
image = reader->GetOutput();
}else{
InputImageType::SpacingType spacing;
spacing[0] = 3.;
spacing[1] = 3.;
spacing[2] = 3.;
image->SetSpacing(spacing);
InputImageType::PointType origin;
origin[0] = 0.;
origin[1] = 0.;
origin[2] = 0.;
image->SetOrigin(origin);
InputImageType::IndexType start;
start[0] = 0;
start[1] = 0;
start[2] = 0;
InputImageType::SizeType size;
size[0] = 61;
size[1] = 61;
size[2] = 61;
InputImageType::RegionType region;
region.SetSize(size);
region.SetIndex(start);
image = InputImageType::New();
image->SetRegions(region);
image->Allocate(true);
image->Update();
using IteratorType = itk::ImageRegionIteratorWithIndex<InputImageType>;
IteratorType iterate(image,