Hi all:<br><br>I am trying to extract a region of interest in a image<br>and using its output as the input of Gradient Filter.<br><br>Therefore, the RegionOfInterestImageFilter is used to extract region<br>and GradientMagnitudeRecursiveGaussianImageFilter used to count gradient.
<br><br>but an unknown erorr is occurrence and my program crashed.<br><br>My program is following:<br><br> typedef float InternalPixelType;<br> typedef itk::Image< InternalPixelType, 3> InternalImageType;
<br><br> typedef signed short OutputPixelType;<br> typedef itk::Image< OutputPixelType, 3> ExternalImageType;<br><br> typedef itk::RescaleIntensityImageFilter<ExternalImageType, InternalImageType> InputCastType;
<br> InputCastType::Pointer m_Cast1;<br><br> m_Cast1->SetInput( an itk::Image that has ExternalImageType );<br> m_Cast1->SetOutputMinimum(0);<br> m_Cast1->SetOutputMaximum( 255 );<br><br> m_Cast1->Update();
<br><br> typedef itk::RegionOfInterestImageFilter<br> < InternalImageType , InternalImageType > FilterType;<br><br> FilterType::Pointer ROI1= FilterType::New();<br><br> InternalImageType::IndexType start;
<br> start[0] = m_ROIxmin;<br> start[1] = m_ROIymin;<br> start[2] = m_ROIzmin;<br><br> InternalImageType::SizeType size;<br> size[0] = m_ROIxmax-m_ROIxmin+1;<br> size[1] = m_ROIymax-m_ROIymin+1;<br> size[2] = m_ROIzmax-m_ROIzmin+1;
<br><br> InternalImageType::RegionType desiredRegion;<br> desiredRegion.SetSize( size );<br> desiredRegion.SetIndex( start );<br><br> ROI1->SetRegionOfInterest( desiredRegion );<br> ROI1->SetInput(m_Cast1->GetOutput());
<br> ROI1->Update();<br><br> typedef itk::< InternalImageType,InternalImageType > GradientFilterType;<br><br> GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New();<br><br> gradientMagnitude->SetSigma( 1 );
<br> gradientMagnitude->SetInput( ROI1->GetOutput() );<br> gradientMagnitude->Update();<br><br><br>Regards :)<br><br><br><br>