[Insight-users] Problems with Sobel filter
doege at mi.fu-berlin.de
doege at mi.fu-berlin.de
Mon Mar 30 04:36:18 EDT 2009
Hello,
I am kind of helpless, I am trying to implement a sobel filter and
getting the following error messages:
I already tried to cast manual but this doesn´t work either. Some how
I need to cast the image(dicom) but I don´t know where and how, can
anyone give me some adwise?
-------------------------------
WARNING: In
c:\insighttoolkit-3.8.0\source\code\basicfilters\itkSobelEdgeDetectionImageFilter.txx, line
95
SobelEdgeDetectionImageFilter (06D6A7F0): Output pixel type MUST be
float or double to prevent computational errors
-------------------------------
template < typename TPixel, unsigned int VImageDimension >
void RegionGrowing( itk::Image<TPixel, VImageDimension>* itkImage,
Step6* step6 )
{
typedef float InternalPixelType;
typedef itk::Image< InternalPixelType, VImageDimension > InternalImageType;
typedef itk::Image< TPixel, VImageDimension > InputImageType; //
Image type
typedef itk::Image< TPixel, VImageDimension > OutputImageType;
OutputImageType::Pointer output;
typedef typename InputImageType::IndexType IndexType;
//Sobel
typedef itk::SobelEdgeDetectionImageFilter< InputImageType,
OutputImageType > SobelFilterType;
try
{
// Apply Sobel Filter
SobelFilterType::Pointer sobelFilter = SobelFilterType::New();
//sobelFilter->SetInput( filter->GetOutput() );
sobelFilter->SetInput((itkImage));
//sobelFilter->Update();
// Write output image
//output->static_cast<itk::Image<TPixel,
VImageDimension>*>(sobelFilter->GetOutput());
// add output of AutomaticSegmentation to tree
mitk::DataTreePreOrderIterator it(step6->m_Tree);
step6->m_ResultNode =
mitk::DataTreeHelper::AddItkImageToDataTree((sobelFilter->GetOutput()), &it,
"segmentation");
step6->m_ResultImage =
static_cast<mitk::Image*>(step6->m_ResultNode->GetData());
}
catch (itk::ExceptionObject & err)
{
std::cout << "ExceptionObject caught !" << std::endl;
std::cout << err << std::endl;
return;
}
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the Insight-users
mailing list