[Insight-users] Segmented volume scaling problem, why its working with 2D and not with 3D?

Bill Lorensen bill.lorensen at gmail.com
Wed Oct 7 09:01:05 EDT 2009


The .5 is to round the size to the nearest integral value.

On Wed, Oct 7, 2009 at 7:41 AM, Juliette Deniau <juliette.deniau at yahoo.fr>wrote:

> Hi Bill,
>
> Thank you very much for your answer.
>
> I tried your code and it is working for my data, thanks. However, what is
> wrong in my code is not the size (I compute it as you did) but it’s in the
> statement code:
>
> resampler->SetOutputDirection ( reader->GetOutput()->GetDirection());
>
> which I do not include in my code. Actually I do not set the direction of
> my resamopling filter(I have not find such thing elsewhere !).
>
> I have another question regarding how you compute the output size. In your
> code you do the following:
>
> outputSize[i] = static_cast<SizeValueType>(inputSize[i] * inputSpacing[i]
> / outputSpacing[i] + .5);
>
> my question is why you add the 0.5 to the outputSpacing[i]? what I’m doing
> to compute the size is the follwing:
>
> outputSize[i] = (inputSize[i] * inputSpacing[i] / outputSpacing[i]);
>
> Regards
>
> Juliette
>
> --- En date de : *Mar 6.10.09, Bill Lorensen <bill.lorensen at gmail.com>* a
> écrit :
>
>
> De: Bill Lorensen <bill.lorensen at gmail.com>
> Objet: Re: [Insight-users] Segmented volume scaling problem, why its
> working with 2D and not with 3D?
> À: "Juliette Deniau" <juliette.deniau at yahoo.fr>
> Cc: "luis ibanez" <luis.ibanez at kitware.com>, "insight" <
> insight-users at itk.org>
> Date: Mardi 6 Octobre 2009, 16h08
>
>
> I suspect that your size calculation is incorrect.
>
> Attached is a program that will resample a meta volume. (Note it uses a
> LinearInterpolateImageFunction. You should change this to a nearest neighbor
> interpolator).
>
> You can see how I calculate the size.
>
> Bill
>
> On Tue, Oct 6, 2009 at 10:09 AM, Juliette Deniau <juliette.deniau at yahoo.fr<http://fr.mc282.mail.yahoo.com/mc/compose?to=juliette.deniau@yahoo.fr>
> > wrote:
>
>>   Dear Luis and Itk users,
>>
> I’m trying to scale a segmented volume (obtained by confidence connected
> filter)using itkAffineTransform but the result volume has information only
> in one slide. When I use the original volume instead of the segmented one,
> the results are fine.
>
> I applied the same code to  2D image ( segmented  image using confidence
> connected filter)and the original image, the results are fine for both of
> them.
>
> What I cannot understand is why  this is working for 2D original image, 2D
> segmented image, the original volume and not for the 3D segmented volume ?
>
> I attach both codes that I use for my test(2D and 3D cases)
>
> Thank you
>
> Juliette
>
>
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> 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
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20091007/dd8fd4c8/attachment-0001.htm>


More information about the Insight-users mailing list