[Insight-users] Problems using itk::VectorFuzzyConnectednessImageFilter

Christian Bauer cbauer at sbox.tugraz.at
Fri Nov 12 08:50:02 EST 2004


Hi!

I have problems using the itk::VectorFuzzyConnectednessImageFilter. I'm
currently using itk 1.8.

I wrote the following code and noticed three problems:
1) There's no method SetObjects for setting the number of objects as explained
at the end of Detailed Description of the class; there's a method
SetNumberOfObjects instead.
2) There's no method SetSelectedObject as explained in the documentation. I
wasn't able to find another appropriate method.
3) When i try to set the properties of the different objects i'm just able to
set the mean and variance of all object. But when i try to set the seed for the
second object a segmentation violation occurs - i'm just able to set the seed
for the first object. I also tried to add another seed to the first object.
There's no problem with that.

typedef itk::Vector< signed short, 1 > PixelType;
typedef itk::Image< PixelType, 2 > ImageType;
typedef unsigned char BinaryPixelType;
typedef itk::Image< BinaryPixelType, 2 > BinaryImageType;

typedef itk::ImageFileReader< ImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName( argv[1] );
ImageType::Pointer scene = reader->GetOutput();
scene->Update();

int numberOfObjects = 3;
int objectOfInterest = 1;

std::vector< ImageType::IndexType > seed;
std::vector< itk::Vector<double, 1> > mean;
std::vector< itk::Matrix<double, 1, 1> > variance;

... init of seed, mean and variance

typedef itk::VectorFuzzyConnectednessImageFilter< ImageType, BinaryImageType >  
FuzzySegmentationFilterType;
  FuzzySegmentationFilterType::Pointer fuzzysegmenter =
FuzzySegmentationFilterType::New();

fuzzysegmenter->SetInput( scene );
fuzzysegmenter->SetNumberOfObjects( numberOfObjects );
//fuzzysegmenter->SetSelectedObject( objectOfInterest );
for (int i=0; i<numberOfObjects; i++)
  {
  fuzzysegmenter->SetObjectsMean( mean[i], i );
  fuzzysegmenter->SetObjectsMatrix( variance[i], i );
  fuzzysegmenter->SetObjectsSeed( seed[i], i );
  }

fuzzysegmenter->Update();

Any suggestions?  Thanks in advance...

Christian




More information about the Insight-users mailing list