[Insight-users] Mutual Information with Mask
Xabier Artaechevarria Artieda
xabiarta at unav.es
Thu May 3 13:30:16 EDT 2007
Hi ITK users,
I am trying to obtain the Mutual Information of two images in a
certain region, applying a mask. I get the error:
itk::ERROR: MutualInformationImageToImageMetric(0x6bc6c0): All the
sampled point mapped to outside of the moving image
I think the problem is in the way I set the mask, because:
1. I get no errors if I do not set it.
2. The error comes out even if I try to calculate the metric between
an image and itself.
3. I have also checked the mask by writing it to a file, and it looks ok.
Below are the last lines of my code. As I said, ?mask.tif? is in fact
a binary image with around one third of the values set to 1, the rest
are 0s.
Am I missing some extra step? What might be wrong?
Thanks in advance for your help,
Xabi
// set the mask as the output of a certain filter
spatialObjectMask->SetImage( filter->GetOutput() );
// write the mask to check the it is correct
typedef itk::ImageFileWriter< ImageMaskType > WriterType;
WriterType::Pointer writer = WriterType::New();
writer->SetFileName("mask.tif");
writer->SetInput(dilateFilter->GetOutput());
writer->Update();
//set the mask
MImetric->SetFixedImageMask( spatialObjectMask );
MImetric->SetMovingImageMask( spatialObjectMask );
//initialize metric
MImetric->Initialize();
//set 0 displacement to translation transform and get metric value
typedef TransformType::ParametersType ParametersType;
ParametersType displacement( transform->GetNumberOfParameters() );
displacement.Fill(0.0);
double value =MImetric->GetValue( displacement );
std::cout << "MI metric " << value << std::endl;
----------------------------------------------------------------
Este mensaje ha sido enviado desde https://webmail.unav.es
More information about the Insight-users
mailing list