[ITK-users] MirrorPadding of masked image
Marco Ulge
marco.ulge at gmail.com
Tue Jun 3 08:43:32 EDT 2014
Hello everybody,
i am pretty new to itk and right now i'm trying to figure out how to pad a
masked image (using itkMirrorPadImageFilter class). I could only achieve it
partially as the following code correctly pads the upper, the left and the
bottom side of the masked image, however the right side's not correctly
padded, i assume because of the mask which sets the pixels to the outside
region.
Can anybody help me with this? Below is my code:
#include "itkImage.h"
#include "itkImageFileReader.h"
#include "itkMaskImageFilter.h"
#include "itkImageRegionIterator.h"
#include "QuickView.h"
#include "itkImageFileWriter.h"
#include "itkMirrorPadImageFilter.h"
typedef itk::Image<unsigned char, 2> ImageType;
void CreateHalfMask(ImageType::Pointer image, ImageType::Pointer &mask);
int main(int argc, char *argv[])
{
if(argc < 2)
{
std::cerr << "Usage: " << argv[0] << " filename" << std::endl;
return EXIT_FAILURE;
}
typedef itk::ImageFileReader<ImageType> ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
reader->Update();
ImageType::Pointer mask = ImageType::New();
CreateHalfMask(reader->GetOutput(), mask);
typedef itk::MaskImageFilter< ImageType, ImageType > MaskFilterType;
MaskFilterType::Pointer maskFilter = MaskFilterType::New();
maskFilter->SetInput(reader->GetOutput());
maskFilter->SetMaskImage(mask);
ImageType::SizeType lowerBound;
lowerBound[0] = 20;
lowerBound[1] = 30;
ImageType::SizeType upperBound;
upperBound[0] = 50;
upperBound[1] = 40;
ecc.
Thanks!
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/ITK-users-MirrorPadding-of-masked-image-tp7585704.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
More information about the Insight-users
mailing list