[Insight-developers] down sampling
Luis Ibanez
luis.ibanez at kitware.com
Fri Jul 10 10:07:57 EDT 2009
Hi Kevin,
Have you saved the images just after down-sampling
and looked at them ?
How do they look ?
Please let us know,
------
BTW: Please submit questions to the itk-users list.
The Developers list is dedicated to discussions related
to code added to ITK or modifications to ITK code.
Thanks
Luis
----------------------------------------------------------------------------------
On Fri, Jul 10, 2009 at 9:19 AM, kevin cavin <beibeiwen2003 at yahoo.com>wrote:
> Hello,
>
> I am using Resamplefilter to downsampling my 3D volume in order to
> register two volumes. Without downsampling and with less slices , I get two
> volume registered. With downsampling, the registered result is non sense
> (empty image). I am woderning where goes wrong? Maybe somepeople can help
> me. Thanks!
>
> wen
>
> I attach part of code
>
> factorX = 2
> factorY = 2
> factorZ = 1
> inputSpacing1 = windowing1.GetOutput().GetSpacing()
> inputSpacing2 = windowing2.GetOutput().GetSpacing()
> resampler1 =itk.ResampleImageFilter.IF3IF3.New()
> resampler2 =itk.ResampleImageFilter.IF3IF3.New()
> transform=itk.IdentityTransform.D3.New()
> transform.SetIdentity()
> resampler1.SetTransform( transform.GetPointer() )
> resampler2.SetTransform( transform.GetPointer() )
> interpolator1=itk.LinearInterpolateImageFunction.IF3D.New()
> resampler1.SetInterpolator( interpolator1.GetPointer() )
> resampler1.SetDefaultPixelValue( 0 )
>
> interpolator2=itk.LinearInterpolateImageFunction.IF3D.New()
> resampler2.SetInterpolator( interpolator2.GetPointer() )
> resampler2.SetDefaultPixelValue( 0 )
>
> spacing1=itk.Vector.D3()
> spacing2=itk.Vector.D3()
>
> spacing1.SetElement(0,inputSpacing1.GetElement(0) * factorX)
> spacing1.SetElement(1,inputSpacing1.GetElement(1) * factorY)
> spacing1.SetElement(2,inputSpacing1.GetElement(2) * factorZ)
> spacing2.SetElement(0,inputSpacing2.GetElement(0) * factorX)
> spacing2.SetElement(1,inputSpacing2.GetElement(1) * factorY)
> spacing2.SetElement(2,inputSpacing2.GetElement(2) * factorZ)
>
> resampler1.SetOutputSpacing( spacing1 )
> resampler1.SetOutputOrigin( windowing1.GetOutput().GetOrigin() )
> resampler1.SetOutputDirection( windowing1.GetOutput().GetDirection() )
> resampler2.SetOutputSpacing( spacing2 )
> resampler2.SetOutputOrigin( windowing2.GetOutput().GetOrigin() )
> resampler2.SetOutputDirection( windowing2.GetOutput().GetDirection() )
>
> inputSize= windowing1.GetOutput().GetLargestPossibleRegion().GetSize()
> print "X size : %f" % (inputSize.GetElement(0), )
> print "Y size : %f" % (inputSize.GetElement(1), )
> print "Z size : %f" % (inputSize.GetElement(2), )
> size=itk.FixedArray.D3()
> new_x=inputSize.GetElement(0)/factorX
> new_y=inputSize.GetElement(1)/factorY
> new_z=inputSize.GetElement(2)/factorZ
>
> inputSize.SetElement(0, int(new_x))
> inputSize.SetElement(1, int(new_y))
> inputSize.SetElement(2, int(new_z))
> resampler1.SetSize( inputSize )
> resampler1.SetInput( windowing1.GetOutput() )
> resampler2.SetSize( inputSize )
> resampler2.SetInput( windowing2.GetOutput() )
>
>
> _______________________________________________
> 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-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090710/28def2b5/attachment.htm>
More information about the Insight-developers
mailing list