ROI提取某一层3D
void clipOneSlice(ImageType::Pointer input,int num_temp,ImageType::Pointer *dst)
{
ImageType::RegionType inputRegion = input->GetLargestPossibleRegion();
ImageType::SizeType size = inputRegion.GetSize();
ImageType::IndexType start = inputRegion.GetIndex();
itk::ImageRegion<3> region(start, size);
ImageType::Pointer mask_data = ImageType::New();
mask_data->SetRegions(region);
mask_data->Allocate();
mask_data->FillBuffer(0);
int z = num_temp;
for (int x=0;x<size[0];x++)
{
for (int y=0;y<size[1];y++)
{
ImageType::IndexType point_temp;
point_temp[0] = x;
point_temp[1] = y;
point_temp[2] = z;
ImageType::PixelType rad_value = input->GetPixel(point_temp);
mask_data->SetPixel(point_temp,rad_value);
}
}
*dst = mask_data;
}