[ITK-users] Error encountered when padding: boundary condition is ITK_NULLPTR
avazuila
mbrunet at insa-rennes.fr
Tue Aug 29 06:56:01 EDT 2017
Hi all,
I just performed the segmentation of a vessel from a CT scan and I would
like to use it to mask the abovementioned vessel on the image. In order to
do so I would like to pad the segmentation image which is smaller than the
image from which it has been extracted.
I get the following error: "PadImageFilter: Boundary condition is
ITK_NULLPTR so no request region can be generated."
My code is the following:
double* voi_bounds = l_import_preprocess.getBounds();
double* seg_bounds = l_import_seg.getBounds();
double x_min = abs(voi_bounds[0] - seg_bounds[0]);
double x_max = abs(voi_bounds[1] - seg_bounds[1]);
double y_min = abs(voi_bounds[2] - seg_bounds[2]);
double y_max = abs(voi_bounds[3] - seg_bounds[3]);
double z_min = abs(voi_bounds[4] - seg_bounds[4]);
double z_max = abs(voi_bounds[5] - seg_bounds[5]);
const int Dimension = 3;
typedef uchar PixelType;
typedef itk::Image< PixelType, Dimension > ImageType;
ImageType::SizeType upper;
ImageType::SizeType lower;
lower[0] = x_min;
lower[1] = y_min;
lower[2] = z_min;
upper[0] = x_max;
upper[1] = y_max;
upper[2] = z_max;
typedef itk::PadImageFilter< ImageType, ImageType > PadFilterType;
PadFilterType::Pointer l_pad = PadFilterType::New();
l_pad->SetInput(l_import_seg.getOutput());
l_pad->SetPadUpperBound(upper);
l_pad->SetPadLowerBound(lower);
typedef itk::ImageFileWriter< ImageType > WriterFilterType;
WriterFilterType::Pointer l_writer = WriterFilterType::New();
l_writer->SetInput(l_pad->GetOutput());
l_writer->SetFileName(logDir.toStdString() + "voi.mhd");
try{
l_writer->Update();
}
catch (itk::ExceptionObject& err) {
M_Error(String(err.what()));
}
I also tried to crop the original image to make it fit the segmentation
dimensions but it always is a few pixels smaller than the segmentation image
and I have no idea why. Moreover, this gap is never the same and seems to be
proportional to the segmentation image size.
Why can't I perform the padding of my segmentation image?
Plus, does anybody know why I can't crop the original image without having a
few pixels less than needed?
Thanks in advance,
Marie
--
View this message in context: http://itk-users.7.n7.nabble.com/Error-encountered-when-padding-boundary-condition-is-ITK-NULLPTR-tp38654.html
Sent from the ITK - Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list