[ITK-users] Using PermuteAxesImageFilter incorrectly
Ricky Singla
rsingla92 at gmail.com
Thu May 15 20:13:23 EDT 2014
Hi there,
I'm having some trouble using the PermuteAxesImageFilter. I have an image,
which I know is allocated correctly and has values in its buffer, that i'm
trying to transpose (swap the X and Y axes). PermuteAxesImageFilter looked
the most suitable. After that filter, I'm subtracting a constant from the
image using the SubtractImageFilter. I've used the PermuteAxesImageFilter
example as a reference, but evidently I'm forgetting something.
Here's a code snip:
void func()
{
typedef itk::PermuteAxesImageFilter<ImageType> PermuteAxesType;
typedef itk::SubtractImageFilter<ImageType, ImageType>
SubtractImageFilterType;
// Allocate Y
// define and set magicalConstant, which is of type ImageType::PixelType
itk::FixedArray<unsigned int, 2> order; order[0] = 1; order[1] = 0;
PermuteAxesType::Pointer permuteAxes = PermuteAxesType::New();
permuteAxes->SetInput(Y);
permuteAxes->SetOrder(order);
permuteAxes->Update();
SubtractImageFilterType::Pointer subtractFilter =
SubtractImageFilterType::New();
subtractFilter->SetInput(permuteAxes->GetOutput());
subtractFilter->SetConstant(magicalConstant);
Y = subtractFilter->GetOutput(); // transposed - magicalConstant
// other stuff
}
Any ideas as to what I'm doing wrong here?
Thanks.
Ricky Singla
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20140515/57d59775/attachment.html>
More information about the Insight-users
mailing list