[Insight-users] Gradient of Vector Image

Bing Jian bjian at cise . ufl . edu
Thu, 9 Oct 2003 20:56:39 -0400 (EDT)


>
> Hi Jian,
>
> It will not be easy, but it will be fun  :-)
>
>
> 1) Create an ImageAdaptor that will
>     extract the components of the Offset
>     and present it as a scalar image.
>
>     follow the example in the SoftwareGuide
>     http://www . itk . org/ItkSoftwareGuide . pdf
>     Section 12.3, pdf-page 526, paper-page 500.
>
> 2) Instantiate three of these ImageAdaptors and
>     set them to extract the components {0,1,2}
>     of the Offset respectively.
>
> 3) Instantiate three GradientRecursiveImageFilters
>     and connect each one to one of the ImageAdaptors.

  To do this, I wrote following code snippet:
================================================================================
  unsigned int i,j, vector_dimension = 3, image_dimension = 3;

  typedef itk::GradientRecursiveGaussianImageFilter<InputScalarImageType,GradientVectorImageType>
GradientFilterType;
  typedef GradientFilterType::Pointer GradientFilterPointer;
  GradientVectorImageType::Pointer gradient_out[vector_dimension];

  typedef itk::ImageAdaptor<  InputVectorImageType,
		VectorPixelAccessor > ImageAdaptorType;
  ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();

  VectorPixelAccessor accessor;
  GradientFilterPointer gradient = GradientFilterType::New();

   for (i=0;i<vector_dimension;i++){
			  accessor.SetIndex(i);
			  adaptor->SetPixelAccessor(accessor);
			  adaptor->SetImage(input);

			  gradient->SetInput(adaptor);

			  gradient->Update();
			  gradient_out[i] = gradient->GetOutput();
  }
================================================================================
  I am getting error at this line:
     gradient->SetInput(adaptor);
  The example is using Rescaler->SetInput(adaptor), but seems
gradientfilter is expecting a pointer to image instead of adaptor.
and there is no method like adaptor->GetOutput().

So what should I do to pass the extracted scalar image to filter?

Thanks in advance!

-- 
Best wishes,
Bing Jian
bjian at cise . ufl . edu