[Insight-users] use itkMultiScaleHessianBasedMeasureImageFilter, got an empty image.

Little Joy joy.king1989 at gmail.com
Mon Apr 8 23:15:22 EDT 2013


hello everyone, I'm a newbie to ITK. I need to use the hessian matrix to
enhance a MRI vessel image, but I get an empty image(black). Here is a
snippet of the code:

#include "itkHessianToObjectnessMeasureImageFilter.h"
#include "itkMultiScaleHessianBasedMeasureImageFilter.h"
#include "itkImageFileReader.h"
#include "itkImageFileWriter.h"
#include "itkRescaleIntensityImageFilter.h"
#include "itkImage.h"

int main( int argc, char *argv[] )
{
  if ( argc < 4 )
    {
    std::cerr << "Missing Parameters: "
              << argv[0]
              << " Input_Image"
              << " Enhanced_Output_Image [SigmaMin SigmaMax
NumberOfSigmaSteps ObjectDimension]" << std::endl;
    return EXIT_FAILURE;
    }

  // Define the dimension of the images
  //const unsigned char Dim = 3;
  const unsigned char Dim = 2;

  typedef unsigned char PixelType;

  // Declare the types of the images
  typedef itk::Image<PixelType,Dim> ImageType;

  typedef itk::ImageFileReader<ImageType> FileReaderType;
  typedef itk::ImageFileWriter<ImageType> FileWriterType;

  typedef itk::RescaleIntensityImageFilter<ImageType> RescaleFilterType;
 
  // Declare the type of enhancement filter
  typedef itk::HessianToObjectnessMeasureImageFilter<double,Dim>
ObjectnessFilterType;
  
  // Declare the type of multiscale enhancement filter
  typedef
itk::MultiScaleHessianBasedMeasureImageFilter<ImageType,ObjectnessFilterType>
MultiScaleEnhancementFilterType;

  FileReaderType::Pointer imageReader = FileReaderType::New();
  imageReader->SetFileName(argv[1]);
  try
  { 
    imageReader->Update();
  }
  catch (itk::ExceptionObject &ex)
  { 
    std::cout << ex << std::endl;
    return EXIT_FAILURE;
  }

  MultiScaleEnhancementFilterType::Pointer multiScaleEnhancementFilter =
MultiScaleEnhancementFilterType::New();
  multiScaleEnhancementFilter->SetInput(imageReader->GetOutput());
  multiScaleEnhancementFilter->SetSigmaStepMethodToLogarithmic();

  ObjectnessFilterType* objectnessFilter =
multiScaleEnhancementFilter->GetHessianToMeasureFilter();
  objectnessFilter->SetScaleObjectnessMeasure(false);
  objectnessFilter->SetBrightObject(true);
  objectnessFilter->SetAlpha(0.5);
  objectnessFilter->SetBeta(0.5);
  objectnessFilter->SetGamma(5.0);

  if ( argc >= 4 )
    {
    multiScaleEnhancementFilter->SetSigmaMin( atof(argv[3])  );
    }

  if ( argc >= 5 )
    {
    multiScaleEnhancementFilter->SetSigmaMax( atof(argv[4]) );
    }

  if ( argc >= 6 )
    {
    multiScaleEnhancementFilter->SetNumberOfSigmaSteps( atoi(argv[5]) );
    }

  if ( argc >= 7 )
    {
    objectnessFilter->SetObjectDimension( atoi(argv[6]) );
    }

  try
  {
    multiScaleEnhancementFilter->Update();
  }
  catch (itk::ExceptionObject &e)
  {
    std::cerr << e << std::endl;
  }
 
  RescaleFilterType::Pointer rescale = RescaleFilterType::New();
  rescale->SetInput(multiScaleEnhancementFilter->GetOutput());
  rescale->SetOutputMinimum(0);
  rescale->SetOutputMaximum(255);

  FileWriterType::Pointer writer = FileWriterType::New();
  writer->SetFileName(argv[2]);
  writer->SetInput(rescale->GetOutput());
  try
  {
    writer->Update();
  }
  catch (itk::ExceptionObject &e)
  {
    std::cerr << e << std::endl;
  }
}
my input parameters: argv[1]="MRI.bmp", argv[2]="OutputImage.bmp",
argv[3]=1.0(SigmaMin), argv[4]=5.0(SigmaMax), argv[5]=5(NumberOfSigmaSteps),
argv[6]=1(ObjectDimension).

Here I got two questions.
1. I got a black image. 
2. When I run my code, it display like: 
    Computing measure for scale with sigma = 1
    Computing measure for scale with sigma = 1.37973
    Computing measure for scale with sigma = 1.90365
    Computing measure for scale with sigma = 2.62653
    Computing measure for scale with sigma = 3.6239
    Computing measure for scale with sigma = 5
I have no idea how to get each scale since the argv[3]=1.0(SigmaMin),
argv[4]=5.0(SigmaMax), argv[5]=5(NumberOfSigmaSteps).

Any help is tremendously appreciated!



--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/use-itkMultiScaleHessianBasedMeasureImageFilter-got-an-empty-image-tp7582706.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.


More information about the Insight-users mailing list