[ITK] Bug in Mattes Mutual information
Constantinus Spanakis
c.spanakis83 at gmail.com
Sat Jan 21 14:11:06 EST 2017
Hello. I want to calculate Mattes mutual information of two images. I
created a mattes metric
metric = MetricType::New();
metric->SetTransform(rigidtransform);
metric->SetUseAllPixels(true);
const unsigned int numberOfParameters = rigidtransform->
GetNumberOfParameters();
metric->SetFixedImage(fixedImage);
metric->SetMovingImage(movingImage);
metric->SetFixedImageRegion(fixedImage->GetLargestPossibleRegion());
metric->SetNumberOfFixedImageSamples(10000);
metric->SetNumberOfHistogramBins(50);
metric->SetNumberOfSpatialSamples(10000);
metric->SetNumberOfThreads(12);
I set metric from the begining as a global variable. Then I wrote a
function called
MetricType::MeasureType test(double *arg ){
//printf("test\n");
MetricType::MeasureType v;
int i;
double a, e, f;
a = arg[0];
e = arg[1];
f = arg[2];
rigidtransform->SetAngle(a);
RigidTransformType::OutputVectorType t = rigidtransform->GetTranslation();
t[0] = e;
t[1] = f;
rigidtransform->SetTranslation(t);
metric->UseAllPixelsOn();
metric->SetTransform(rigidtransform);
try{
v = metric->GetValue(rigidtransform->GetParameters());
}
catch (itk::ExceptionObject & err){
v = 1;
}
return v;
}
Whenever I call the test function test with arguments:
double p[3];
p[0] = 0;
p[1] = 0;
p[2] = 0;
The programm shows an unhandled exception due to Access Violation reading,
which doesn't make sense. What could be the problem?
Thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170121/18fb96ca/attachment.html>
More information about the Community
mailing list