[Insight-users] applying a metric to a pair of images

David Pastor david.pastor at die.upm.es
Wed Nov 17 11:49:12 EST 2010


Dear all,

I've been trying to apply a metric to a couple of images but I get an arror when getting the value... I just want to calculate the metric for the images as they are, so I use an Indentity transform. The error seems to be handled even with a try/catch. I use the review version of the registration with multithreading...

Best!
David

here is the code

try{

MetricSSD::Pointer metricSSD = MetricSSD::New();

Transform::Pointer transform = Transform::New();

Interpolator::Pointer interpolator = Interpolator::New();

transform->SetIdentity(); 

MetricSSD::TransformParametersType param = transform->GetParameters();

std::cout<<"Params to metric"<<param[0]<<" "<<param[1]<<" "<<param[2]<<" "<<param[3]<<" "<<param[4]<<" "<<param[5]<<std::endl;

metricSSD->SetTransform(transform);

metricSSD->SetInterpolator(interpolator);

metricSSD->SetFixedImage(RegisterFactory::SampleToInternal(fixed));

metricSSD->SetMovingImage(RegisterFactory::SampleToInternal(moving));

MetricSSD::TransformParametersType paramT(metricSSD->GetNumberOfParameters());

paramT[0]=param[0];paramT[1]=param[1];paramT[2]=param[2];

paramT[3]=param[3];paramT[4]=param[4];paramT[5]=param[5];


mVal = (double)metricSSD->GetValue(paramT);


std::cout<<"Pixels counted " <<metricSSD->GetNumberOfPixelsCounted()<<std::endl;

}catch(itk::ExceptionObject &e){

std::cerr<<"Error"<<std::endl; 

std::cerr<<e<<std::endl;

}



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20101117/57f0aeb3/attachment.htm>


More information about the Insight-users mailing list