[Insight-users] Connection between RegionOfInterestImageFilter and GradientMagnitudeRecursiveGaussianImageFilter

Goo gtshowtime at gmail.com
Thu Mar 29 13:22:23 EST 2007


Hi peter:

Thanks for your reply.
I get the error message using try-catch in following.

itk::ERROR: RecursiveGaussianImageFilter(01766140): The number of pixels
along d
irection 2 is less than 4. This filter requires a minimum of four pixels
along t
he dimension to be processed.

Therefore, this problem is due to
>    size[2] = m_ROIzmax-m_ROIzmin+1;
this size must greater than four.

:)



2007/3/30, Peter Cech <pcech at vision.ee.ethz.ch>:
>
> On Fri, Mar 30, 2007 at 00:12:44 +0800, Goo wrote:
> > 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.
>
> I did not spot anything wrong in the code, but as you did not write
> anything more specific about the crash, I'll assume either unhandled
> exception or segfault. For unhandled exception, put this around your
> code (I'm putting it around my code in main, so it catches everything):
>
>
>   try {
>
>     [your code]
>
>   } catch( std::exception & e ) {
>     std::cout << "Exception caught: " << e.what() << std::endl;
>   } catch( ... ) {
>     std::cout << "Unknown exception caught!" << std::endl;
>   }
>
>
> It will print out the place and cause of the exception thrown.
>
> In the case of segfault, I'm afraid the best thing is to run the program
> in a debugger and try to find what's going on.
>
> Good luck in solving the problem!
>
> Regards,
> Peter
>
> PS: I've just remembered one of my problems with
> RegionOfInterestImageFilter. The region in question has to be a
> subregion of input image's region. Do
>
>   desiredRegion.Crop( m_Cast1->GetOutput()->GetLargestPossibleRegion() );
>
> before assigning the region for cropping.
>
>
>
> > 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 :)
>
> > _______________________________________________
> > Insight-users mailing list
> > Insight-users at itk.org
> > http://www.itk.org/mailman/listinfo/insight-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070330/8062e548/attachment.htm


More information about the Insight-users mailing list