[Insight-users] Connection between RegionOfInterestImageFilter and GradientMagnitudeRecursiveGaussianImageFilter

Goo gtshowtime at gmail.com
Thu Mar 29 11:12:44 EST 2007


Hi all:

I am trying to extract a region of interest in a image
and using its output as the input of Gradient Filter.

Therefore, the RegionOfInterestImageFilter is used to extract region
and GradientMagnitudeRecursiveGaussianImageFilter used to count gradient.

but an unknown erorr is occurrence and my program crashed.

My program is following:

    typedef    float           InternalPixelType;
    typedef itk::Image< InternalPixelType, 3>  InternalImageType;

    typedef    signed short    OutputPixelType;
    typedef itk::Image< OutputPixelType, 3>    ExternalImageType;

    typedef itk::RescaleIntensityImageFilter<ExternalImageType,
InternalImageType> InputCastType;
    InputCastType::Pointer m_Cast1;

    m_Cast1->SetInput(    an itk::Image that has ExternalImageType   );
    m_Cast1->SetOutputMinimum(0);
    m_Cast1->SetOutputMaximum( 255 );

    m_Cast1->Update();

    typedef itk::RegionOfInterestImageFilter
        < InternalImageType , InternalImageType > FilterType;

    FilterType::Pointer ROI1= FilterType::New();

    InternalImageType::IndexType start;
    start[0] = m_ROIxmin;
    start[1] = m_ROIymin;
    start[2] = m_ROIzmin;

    InternalImageType::SizeType size;
    size[0] = m_ROIxmax-m_ROIxmin+1;
    size[1] = m_ROIymax-m_ROIymin+1;
    size[2] = m_ROIzmax-m_ROIzmin+1;

    InternalImageType::RegionType desiredRegion;
    desiredRegion.SetSize(  size  );
    desiredRegion.SetIndex( start );

    ROI1->SetRegionOfInterest( desiredRegion );
    ROI1->SetInput(m_Cast1->GetOutput());
    ROI1->Update();

    typedef itk::< InternalImageType,InternalImageType >
GradientFilterType;

    GradientFilterType::Pointer        gradientMagnitude =
GradientFilterType::New();

    gradientMagnitude->SetSigma(  1 );
    gradientMagnitude->SetInput( ROI1->GetOutput() );
    gradientMagnitude->Update();


Regards :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070330/26dace07/attachment.html


More information about the Insight-users mailing list