[ITK] [ITK-users] Using PermuteAxesImageFilter incorrectly

Bill Lorensen bill.lorensen at gmail.com
Fri May 16 08:11:11 EDT 2014


Do
subtractFilter->Update();

before you ask for the output.

On Thu, May 15, 2014 at 8:13 PM, Ricky Singla <rsingla92 at gmail.com> wrote:
> 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
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>



-- 
Unpaid intern in BillsBasement at noware dot com
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.itk.org/mailman/listinfo/insight-users



More information about the Community mailing list