33 m_XmlFileName =
"mitkRigidRegistrationPresets.xml";
49 vtkXMLParser::SetStream(&presetStream);
51 if (!vtkXMLParser::Parse())
54 MITK_INFO <<
"RigidRegistrationPreset::LoadPreset xml file cannot parse!" << std::endl;
62 std::map<std::string, itk::Array<double>> newMetricValues,
63 std::map<std::string, itk::Array<double>> newOptimizerValues,
64 std::map<std::string, itk::Array<double>> newInterpolatorValues,
67 if (!fileName.empty())
69 m_XmlFileName = fileName;
71 m_TransformValues = newTransformValues;
72 m_MetricValues = newMetricValues;
73 m_OptimizerValues = newOptimizerValues;
74 m_InterpolatorValues = newInterpolatorValues;
78 void RigidRegistrationPreset::StartElement(
const char *elementName,
const char **atts)
80 std::string elementNameString = elementName;
81 if (elementNameString ==
"preset")
83 m_Name = ReadXMLStringAttribut(
"NAME", atts);
85 else if (elementNameString ==
"transform")
87 itk::Array<double> transformValues;
88 transformValues.SetSize(25);
89 transformValues.fill(0);
90 std::string transform = ReadXMLStringAttribut(
"TRANSFORM", atts);
91 double trans = atof(transform.c_str());
92 transformValues[0] = trans;
93 MITK_DEBUG(
"RigidRegistration.Preset.StartElement ") <<
"Name tag: " << m_Name;
94 transformValues = this->loadTransformValues(transformValues, trans, atts);
95 m_TransformValues[m_Name] = transformValues;
97 else if (elementNameString ==
"metric")
99 itk::Array<double> metricValues;
100 metricValues.SetSize(25);
101 metricValues.fill(0);
102 std::string metric = ReadXMLStringAttribut(
"METRIC", atts);
103 double met = atof(metric.c_str());
104 metricValues[0] = met;
105 metricValues = this->loadMetricValues(metricValues, met, atts);
106 m_MetricValues[m_Name] = metricValues;
108 else if (elementNameString ==
"optimizer")
110 itk::Array<double> optimizerValues;
111 optimizerValues.SetSize(25);
112 optimizerValues.fill(0);
113 std::string optimizer = ReadXMLStringAttribut(
"OPTIMIZER", atts);
114 double opt = atof(optimizer.c_str());
115 optimizerValues[0] = opt;
116 optimizerValues = this->loadOptimizerValues(optimizerValues, opt, atts);
117 m_OptimizerValues[m_Name] = optimizerValues;
119 else if (elementNameString ==
"interpolator")
121 itk::Array<double> interpolatorValues;
122 interpolatorValues.SetSize(25);
123 interpolatorValues.fill(0);
124 std::string interpolator = ReadXMLStringAttribut(
"INTERPOLATOR", atts);
125 double inter = atof(interpolator.c_str());
126 interpolatorValues[0] = inter;
127 interpolatorValues = this->loadInterpolatorValues(interpolatorValues );
128 m_InterpolatorValues[m_Name] = interpolatorValues;
132 std::string RigidRegistrationPreset::ReadXMLStringAttribut(std::string name,
const char **atts)
136 const char **attsIter = atts;
140 if (name == *attsIter)
150 return std::string();
158 return m_InterpolatorValues[name];
165 for (
auto preset : m_TransformValues)
167 m_LoadedPresets.push_back(preset.first);
170 return m_LoadedPresets;
175 return m_TransformValues;
180 return m_MetricValues;
185 return m_OptimizerValues;
190 return m_InterpolatorValues;
193 bool RigidRegistrationPreset::save()
199 itk::Array<double> RigidRegistrationPreset::loadTransformValues(itk::Array<double> transformValues,
210 std::string useScales = ReadXMLStringAttribut(
"USESCALES", atts);
211 double useSca = atof(useScales.c_str());
212 transformValues[1] = useSca;
213 std::string scale1 = ReadXMLStringAttribut(
"SCALE1", atts);
214 double sca1 = atof(scale1.c_str());
215 transformValues[2] = sca1;
216 std::string scale2 = ReadXMLStringAttribut(
"SCALE2", atts);
217 double sca2 = atof(scale2.c_str());
218 transformValues[3] = sca2;
219 std::string scale3 = ReadXMLStringAttribut(
"SCALE3", atts);
220 double sca3 = atof(scale3.c_str());
221 transformValues[4] = sca3;
226 std::string useScales = ReadXMLStringAttribut(
"USESCALES", atts);
227 double useSca = atof(useScales.c_str());
228 transformValues[1] = useSca;
229 std::string scale1 = ReadXMLStringAttribut(
"SCALE1", atts);
230 double sca1 = atof(scale1.c_str());
231 transformValues[2] = sca1;
232 std::string scale2 = ReadXMLStringAttribut(
"SCALE2", atts);
233 double sca2 = atof(scale2.c_str());
234 transformValues[3] = sca2;
235 std::string scale3 = ReadXMLStringAttribut(
"SCALE3", atts);
236 double sca3 = atof(scale3.c_str());
237 transformValues[4] = sca3;
238 std::string scale4 = ReadXMLStringAttribut(
"SCALE4", atts);
239 double sca4 = atof(scale4.c_str());
240 transformValues[5] = sca4;
241 std::string scale5 = ReadXMLStringAttribut(
"SCALE5", atts);
242 double sca5 = atof(scale5.c_str());
243 transformValues[6] = sca5;
244 std::string scale6 = ReadXMLStringAttribut(
"SCALE6", atts);
245 double sca6 = atof(scale6.c_str());
246 transformValues[7] = sca6;
247 std::string scale7 = ReadXMLStringAttribut(
"SCALE7", atts);
248 double sca7 = atof(scale7.c_str());
249 transformValues[8] = sca7;
250 std::string scale8 = ReadXMLStringAttribut(
"SCALE8", atts);
251 double sca8 = atof(scale8.c_str());
252 transformValues[9] = sca8;
253 std::string scale9 = ReadXMLStringAttribut(
"SCALE9", atts);
254 double sca9 = atof(scale9.c_str());
255 transformValues[10] = sca9;
256 std::string scale10 = ReadXMLStringAttribut(
"SCALE10", atts);
257 double sca10 = atof(scale10.c_str());
258 transformValues[11] = sca10;
259 std::string scale11 = ReadXMLStringAttribut(
"SCALE11", atts);
260 double sca11 = atof(scale11.c_str());
261 transformValues[12] = sca11;
262 std::string scale12 = ReadXMLStringAttribut(
"SCALE12", atts);
263 double sca12 = atof(scale12.c_str());
264 transformValues[13] = sca12;
266 std::string useInitializer = ReadXMLStringAttribut(
"USEINITIALIZER", atts);
267 double useIni = atof(useInitializer.c_str());
268 transformValues[14] = useIni;
269 std::string useMoments = ReadXMLStringAttribut(
"USEMOMENTS", atts);
270 double useMo = atof(useMoments.c_str());
271 transformValues[15] = useMo;
278 std::string useScales = ReadXMLStringAttribut(
"USESCALES", atts);
279 double useSca = atof(useScales.c_str());
280 transformValues[1] = useSca;
281 std::string scale1 = ReadXMLStringAttribut(
"SCALE1", atts);
282 double sca1 = atof(scale1.c_str());
283 transformValues[2] = sca1;
284 std::string scale2 = ReadXMLStringAttribut(
"SCALE2", atts);
285 double sca2 = atof(scale2.c_str());
286 transformValues[3] = sca2;
287 std::string scale3 = ReadXMLStringAttribut(
"SCALE3", atts);
288 double sca3 = atof(scale3.c_str());
289 transformValues[4] = sca3;
290 std::string scale4 = ReadXMLStringAttribut(
"SCALE4", atts);
291 double sca4 = atof(scale4.c_str());
292 transformValues[5] = sca4;
293 std::string scale5 = ReadXMLStringAttribut(
"SCALE5", atts);
294 double sca5 = atof(scale5.c_str());
295 transformValues[6] = sca5;
296 std::string scale6 = ReadXMLStringAttribut(
"SCALE6", atts);
297 double sca6 = atof(scale6.c_str());
298 transformValues[7] = sca6;
299 std::string useInitializer = ReadXMLStringAttribut(
"USEINITIALIZER", atts);
300 double useIni = atof(useInitializer.c_str());
301 transformValues[8] = useIni;
302 std::string useMoments = ReadXMLStringAttribut(
"USEMOMENTS", atts);
303 double useMo = atof(useMoments.c_str());
304 transformValues[9] = useMo;
309 std::string useScales = ReadXMLStringAttribut(
"USESCALES", atts);
310 double useSca = atof(useScales.c_str());
311 transformValues[1] = useSca;
312 std::string scale1 = ReadXMLStringAttribut(
"SCALE1", atts);
313 double sca1 = atof(scale1.c_str());
314 transformValues[2] = sca1;
315 std::string scale2 = ReadXMLStringAttribut(
"SCALE2", atts);
316 double sca2 = atof(scale2.c_str());
317 transformValues[3] = sca2;
318 std::string scale3 = ReadXMLStringAttribut(
"SCALE3", atts);
319 double sca3 = atof(scale3.c_str());
320 transformValues[4] = sca3;
321 std::string scale4 = ReadXMLStringAttribut(
"SCALE4", atts);
322 double sca4 = atof(scale4.c_str());
323 transformValues[5] = sca4;
324 std::string scale5 = ReadXMLStringAttribut(
"SCALE5", atts);
325 double sca5 = atof(scale5.c_str());
326 transformValues[6] = sca5;
327 std::string scale6 = ReadXMLStringAttribut(
"SCALE6", atts);
328 double sca6 = atof(scale6.c_str());
329 transformValues[7] = sca6;
330 std::string scale7 = ReadXMLStringAttribut(
"SCALE7", atts);
331 double sca7 = atof(scale7.c_str());
332 transformValues[8] = sca7;
333 std::string useInitializer = ReadXMLStringAttribut(
"USEINITIALIZER", atts);
334 double useIni = atof(useInitializer.c_str());
335 transformValues[9] = useIni;
336 std::string useMoments = ReadXMLStringAttribut(
"USEMOMENTS", atts);
337 double useMo = atof(useMoments.c_str());
338 transformValues[10] = useMo;
342 std::string useScales = ReadXMLStringAttribut(
"USESCALES", atts);
343 double useSca = atof(useScales.c_str());
344 transformValues[1] = useSca;
345 std::string scale1 = ReadXMLStringAttribut(
"SCALE1", atts);
346 double sca1 = atof(scale1.c_str());
347 transformValues[2] = sca1;
348 std::string scale2 = ReadXMLStringAttribut(
"SCALE2", atts);
349 double sca2 = atof(scale2.c_str());
350 transformValues[3] = sca2;
351 std::string scale3 = ReadXMLStringAttribut(
"SCALE3", atts);
352 double sca3 = atof(scale3.c_str());
353 transformValues[4] = sca3;
354 std::string scale4 = ReadXMLStringAttribut(
"SCALE4", atts);
355 double sca4 = atof(scale4.c_str());
356 transformValues[5] = sca4;
357 std::string scale5 = ReadXMLStringAttribut(
"SCALE5", atts);
358 double sca5 = atof(scale5.c_str());
359 transformValues[6] = sca5;
360 std::string scale6 = ReadXMLStringAttribut(
"SCALE6", atts);
361 double sca6 = atof(scale6.c_str());
362 transformValues[7] = sca6;
363 std::string scale7 = ReadXMLStringAttribut(
"SCALE7", atts);
364 double sca7 = atof(scale7.c_str());
365 transformValues[8] = sca7;
366 std::string scale8 = ReadXMLStringAttribut(
"SCALE8", atts);
367 double sca8 = atof(scale8.c_str());
368 transformValues[9] = sca8;
369 std::string scale9 = ReadXMLStringAttribut(
"SCALE9", atts);
370 double sca9 = atof(scale9.c_str());
371 transformValues[10] = sca9;
372 std::string scale10 = ReadXMLStringAttribut(
"SCALE10", atts);
373 double sca10 = atof(scale10.c_str());
374 transformValues[11] = sca10;
375 std::string scale11 = ReadXMLStringAttribut(
"SCALE11", atts);
376 double sca11 = atof(scale11.c_str());
377 transformValues[12] = sca11;
378 std::string scale12 = ReadXMLStringAttribut(
"SCALE12", atts);
379 double sca12 = atof(scale12.c_str());
380 transformValues[13] = sca12;
381 std::string scale13 = ReadXMLStringAttribut(
"SCALE13", atts);
382 double sca13 = atof(scale13.c_str());
383 transformValues[14] = sca13;
384 std::string scale14 = ReadXMLStringAttribut(
"SCALE14", atts);
385 double sca14 = atof(scale14.c_str());
386 transformValues[15] = sca14;
387 std::string scale15 = ReadXMLStringAttribut(
"SCALE15", atts);
388 double sca15 = atof(scale15.c_str());
389 transformValues[16] = sca15;
390 std::string useInitializer = ReadXMLStringAttribut(
"USEINITIALIZER", atts);
391 double useIni = atof(useInitializer.c_str());
392 transformValues[17] = useIni;
393 std::string useMoments = ReadXMLStringAttribut(
"USEMOMENTS", atts);
394 double useMo = atof(useMoments.c_str());
395 transformValues[18] = useMo;
399 std::string useScales = ReadXMLStringAttribut(
"USESCALES", atts);
400 double useSca = atof(useScales.c_str());
401 transformValues[1] = useSca;
402 std::string scale1 = ReadXMLStringAttribut(
"SCALE1", atts);
403 double sca1 = atof(scale1.c_str());
404 transformValues[2] = sca1;
405 std::string scale2 = ReadXMLStringAttribut(
"SCALE2", atts);
406 double sca2 = atof(scale2.c_str());
407 transformValues[3] = sca2;
408 std::string scale3 = ReadXMLStringAttribut(
"SCALE3", atts);
409 double sca3 = atof(scale3.c_str());
410 transformValues[4] = sca3;
411 std::string scale4 = ReadXMLStringAttribut(
"SCALE4", atts);
412 double sca4 = atof(scale4.c_str());
413 transformValues[5] = sca4;
414 std::string scale5 = ReadXMLStringAttribut(
"SCALE5", atts);
415 double sca5 = atof(scale5.c_str());
416 transformValues[6] = sca5;
417 std::string angle = ReadXMLStringAttribut(
"ANGLE", atts);
418 double ang = atof(angle.c_str());
419 transformValues[7] = ang;
420 std::string useInitializer = ReadXMLStringAttribut(
"USEINITIALIZER", atts);
421 double useIni = atof(useInitializer.c_str());
422 transformValues[8] = useIni;
423 std::string useMoments = ReadXMLStringAttribut(
"USEMOMENTS", atts);
424 double useMo = atof(useMoments.c_str());
425 transformValues[9] = useMo;
429 std::string useScales = ReadXMLStringAttribut(
"USESCALES", atts);
430 double useSca = atof(useScales.c_str());
431 transformValues[1] = useSca;
432 std::string scale1 = ReadXMLStringAttribut(
"SCALE1", atts);
433 double sca1 = atof(scale1.c_str());
434 transformValues[2] = sca1;
435 std::string scale2 = ReadXMLStringAttribut(
"SCALE2", atts);
436 double sca2 = atof(scale2.c_str());
437 transformValues[3] = sca2;
438 std::string scale3 = ReadXMLStringAttribut(
"SCALE3", atts);
439 double sca3 = atof(scale3.c_str());
440 transformValues[4] = sca3;
441 std::string scale4 = ReadXMLStringAttribut(
"SCALE4", atts);
442 double sca4 = atof(scale4.c_str());
443 transformValues[5] = sca4;
444 std::string scale = ReadXMLStringAttribut(
"SCALE", atts);
445 double sca = atof(scale.c_str());
446 transformValues[6] = sca;
447 std::string angle = ReadXMLStringAttribut(
"ANGLE", atts);
448 double ang = atof(angle.c_str());
449 transformValues[7] = ang;
450 std::string useInitializer = ReadXMLStringAttribut(
"USEINITIALIZER", atts);
451 double useIni = atof(useInitializer.c_str());
452 transformValues[8] = useIni;
453 std::string useMoments = ReadXMLStringAttribut(
"USEMOMENTS", atts);
454 double useMo = atof(useMoments.c_str());
455 transformValues[9] = useMo;
459 std::string useScales = ReadXMLStringAttribut(
"USESCALES", atts);
460 double useSca = atof(useScales.c_str());
461 transformValues[1] = useSca;
462 std::string scale1 = ReadXMLStringAttribut(
"SCALE1", atts);
463 double sca1 = atof(scale1.c_str());
464 transformValues[2] = sca1;
465 std::string scale2 = ReadXMLStringAttribut(
"SCALE2", atts);
466 double sca2 = atof(scale2.c_str());
467 transformValues[3] = sca2;
468 std::string scale3 = ReadXMLStringAttribut(
"SCALE3", atts);
469 double sca3 = atof(scale3.c_str());
470 transformValues[4] = sca3;
471 std::string scale4 = ReadXMLStringAttribut(
"SCALE4", atts);
472 double sca4 = atof(scale4.c_str());
473 transformValues[5] = sca4;
474 std::string scale5 = ReadXMLStringAttribut(
"SCALE5", atts);
475 double sca5 = atof(scale5.c_str());
476 transformValues[6] = sca5;
477 std::string scale6 = ReadXMLStringAttribut(
"SCALE6", atts);
478 double sca6 = atof(scale6.c_str());
479 transformValues[7] = sca6;
480 std::string scale = ReadXMLStringAttribut(
"SCALE", atts);
481 double sca = atof(scale.c_str());
482 transformValues[8] = sca;
483 std::string angle = ReadXMLStringAttribut(
"ANGLE", atts);
484 double ang = atof(angle.c_str());
485 transformValues[9] = ang;
486 std::string useInitializer = ReadXMLStringAttribut(
"USEINITIALIZER", atts);
487 double useIni = atof(useInitializer.c_str());
488 transformValues[10] = useIni;
489 std::string useMoments = ReadXMLStringAttribut(
"USEMOMENTS", atts);
490 double useMo = atof(useMoments.c_str());
491 transformValues[11] = useMo;
494 MITK_DEBUG(
"RigidRegistration.Preset.LoadValue ") << transformValues;
495 return transformValues;
498 itk::Array<double> RigidRegistrationPreset::loadMetricValues(itk::Array<double> metricValues,
502 std::string computeGradient = ReadXMLStringAttribut(
"COMPUTEGRADIENT", atts);
503 double compGra = atof(computeGradient.c_str());
504 metricValues[1] = compGra;
518 std::string histogramBins = ReadXMLStringAttribut(
"HISTOGRAMBINS", atts);
519 double histBins = atof(histogramBins.c_str());
520 metricValues[2] = histBins;
524 std::string useSampling = ReadXMLStringAttribut(
"USESAMPLING", atts);
525 double useSamp = atof(useSampling.c_str());
526 metricValues[2] = useSamp;
527 std::string spatialSamples = ReadXMLStringAttribut(
"SPATIALSAMPLES", atts);
528 double spatSamp = atof(spatialSamples.c_str());
529 metricValues[3] = spatSamp;
530 std::string histogramBins = ReadXMLStringAttribut(
"HISTOGRAMBINS", atts);
531 double histBins = atof(histogramBins.c_str());
532 metricValues[4] = histBins;
536 std::string lambda = ReadXMLStringAttribut(
"LAMBDA", atts);
537 double lamb = atof(lambda.c_str());
538 metricValues[2] = lamb;
542 std::string spatialSamples = ReadXMLStringAttribut(
"SPATIALSAMPLES", atts);
543 double spatSamp = atof(spatialSamples.c_str());
544 metricValues[2] = spatSamp;
545 std::string fixedStandardDeviation = ReadXMLStringAttribut(
"FIXEDSTANDARDDEVIATION", atts);
546 double fiStaDev = atof(fixedStandardDeviation.c_str());
547 metricValues[3] = fiStaDev;
548 std::string movingStandardDeviation = ReadXMLStringAttribut(
"MOVINGSTANDARDDEVIATION", atts);
549 double moStaDev = atof(movingStandardDeviation.c_str());
550 metricValues[4] = moStaDev;
551 std::string useNormalizer = ReadXMLStringAttribut(
"USENORMALIZERANDSMOOTHER", atts);
552 double useNormal = atof(useNormalizer.c_str());
553 metricValues[5] = useNormal;
554 std::string fixedSmootherVariance = ReadXMLStringAttribut(
"FIXEDSMOOTHERVARIANCE", atts);
555 double fiSmoVa = atof(fixedSmootherVariance.c_str());
556 metricValues[6] = fiSmoVa;
557 std::string movingSmootherVariance = ReadXMLStringAttribut(
"MOVINGSMOOTHERVARIANCE", atts);
558 double moSmoVa = atof(movingSmootherVariance.c_str());
559 metricValues[7] = moSmoVa;
564 itk::Array<double> RigidRegistrationPreset::loadOptimizerValues(itk::Array<double> optimizerValues,
568 std::string maximize = ReadXMLStringAttribut(
"MAXIMIZE", atts);
569 double max = atof(maximize.c_str());
570 optimizerValues[1] =
max;
573 std::string stepLength = ReadXMLStringAttribut(
"STEPLENGTH", atts);
574 double stepLe = atof(stepLength.c_str());
575 optimizerValues[2] = stepLe;
576 std::string numberOfSteps = ReadXMLStringAttribut(
"NUMBEROFSTEPS", atts);
577 double numSteps = atof(numberOfSteps.c_str());
578 optimizerValues[3] = numSteps;
583 std::string learningRate = ReadXMLStringAttribut(
"LEARNINGRATE", atts);
584 double learn = atof(learningRate.c_str());
585 optimizerValues[2] = learn;
586 std::string numberIterations = ReadXMLStringAttribut(
"NUMBERITERATIONS", atts);
587 double numIt = atof(numberIterations.c_str());
588 optimizerValues[3] = numIt;
595 std::string shrinkFactor = ReadXMLStringAttribut(
"SHRINKFACTOR", atts);
596 double shrink = atof(shrinkFactor.c_str());
597 optimizerValues[2] = shrink;
598 std::string growthFactor = ReadXMLStringAttribut(
"GROWTHFACTOR", atts);
599 double growth = atof(growthFactor.c_str());
600 optimizerValues[3] = growth;
601 std::string epsilon = ReadXMLStringAttribut(
"EPSILON", atts);
602 double eps = atof(epsilon.c_str());
603 optimizerValues[4] =
eps;
604 std::string initialRadius = ReadXMLStringAttribut(
"INITIALRADIUS", atts);
605 double initRad = atof(initialRadius.c_str());
606 optimizerValues[5] = initRad;
607 std::string numberIterations = ReadXMLStringAttribut(
"NUMBERITERATIONS", atts);
608 double numIt = atof(numberIterations.c_str());
609 optimizerValues[6] = numIt;
613 std::string stepLength = ReadXMLStringAttribut(
"STEPLENGTH", atts);
614 double stepLe = atof(stepLength.c_str());
615 optimizerValues[2] = stepLe;
616 std::string stepTolerance = ReadXMLStringAttribut(
"STEPTOLERANCE", atts);
617 double stepTo = atof(stepTolerance.c_str());
618 optimizerValues[3] = stepTo;
619 std::string valueTolerance = ReadXMLStringAttribut(
"VALUETOLERANCE", atts);
620 double valTo = atof(valueTolerance.c_str());
621 optimizerValues[4] = valTo;
622 std::string numberIterations = ReadXMLStringAttribut(
"NUMBERITERATIONS", atts);
623 double numIt = atof(numberIterations.c_str());
624 optimizerValues[5] = numIt;
628 std::string useFletchReeves = ReadXMLStringAttribut(
"USEFLETCHREEVES", atts);
629 double useFleRe = atof(useFletchReeves.c_str());
630 optimizerValues[2] = useFleRe;
631 std::string stepLength = ReadXMLStringAttribut(
"STEPLENGTH", atts);
632 double stepLe = atof(stepLength.c_str());
633 optimizerValues[3] = stepLe;
634 std::string numberIterations = ReadXMLStringAttribut(
"NUMBERITERATIONS", atts);
635 double numIt = atof(numberIterations.c_str());
636 optimizerValues[4] = numIt;
640 std::string gradientMagnitudeTolerance = ReadXMLStringAttribut(
"GRADIENTMAGNITUDETOLERANCE", atts);
641 double graMagTo = atof(gradientMagnitudeTolerance.c_str());
642 optimizerValues[2] = graMagTo;
643 std::string minStepLength = ReadXMLStringAttribut(
"MINSTEPLENGTH", atts);
644 double minStep = atof(minStepLength.c_str());
645 optimizerValues[3] = minStep;
646 std::string maxStepLength = ReadXMLStringAttribut(
"MAXSTEPLENGTH", atts);
647 double maxStep = atof(maxStepLength.c_str());
648 optimizerValues[4] = maxStep;
649 std::string relaxationFactor = ReadXMLStringAttribut(
"RELAXATIONFACTOR", atts);
650 double relFac = atof(relaxationFactor.c_str());
651 optimizerValues[5] = relFac;
652 std::string numberIterations = ReadXMLStringAttribut(
"NUMBERITERATIONS", atts);
653 double numIt = atof(numberIterations.c_str());
654 optimizerValues[6] = numIt;
659 std::string gradientMagnitudeTolerance = ReadXMLStringAttribut(
"GRADIENTMAGNITUDETOLERANCE", atts);
660 double graMagTo = atof(gradientMagnitudeTolerance.c_str());
661 optimizerValues[2] = graMagTo;
662 std::string minStepLength = ReadXMLStringAttribut(
"MINSTEPLENGTH", atts);
663 double minStep = atof(minStepLength.c_str());
664 optimizerValues[3] = minStep;
665 std::string maxStepLength = ReadXMLStringAttribut(
"MAXSTEPLENGTH", atts);
666 double maxStep = atof(maxStepLength.c_str());
667 optimizerValues[4] = maxStep;
668 std::string numberIterations = ReadXMLStringAttribut(
"NUMBERITERATIONS", atts);
669 double numIt = atof(numberIterations.c_str());
670 optimizerValues[5] = numIt;
674 std::string simplexDelta1 = ReadXMLStringAttribut(
"SIMPLEXDELTA1", atts);
675 double simpDel1 = atof(simplexDelta1.c_str());
676 optimizerValues[2] = simpDel1;
677 std::string simplexDelta2 = ReadXMLStringAttribut(
"SIMPLEXDELTA2", atts);
678 double simpDel2 = atof(simplexDelta2.c_str());
679 optimizerValues[3] = simpDel2;
680 std::string simplexDelta3 = ReadXMLStringAttribut(
"SIMPLEXDELTA3", atts);
681 double simpDel3 = atof(simplexDelta3.c_str());
682 optimizerValues[4] = simpDel3;
683 std::string simplexDelta4 = ReadXMLStringAttribut(
"SIMPLEXDELTA4", atts);
684 double simpDel4 = atof(simplexDelta4.c_str());
685 optimizerValues[5] = simpDel4;
686 std::string simplexDelta5 = ReadXMLStringAttribut(
"SIMPLEXDELTA5", atts);
687 double simpDel5 = atof(simplexDelta5.c_str());
688 optimizerValues[6] = simpDel5;
689 std::string simplexDelta6 = ReadXMLStringAttribut(
"SIMPLEXDELTA6", atts);
690 double simpDel6 = atof(simplexDelta6.c_str());
691 optimizerValues[7] = simpDel6;
692 std::string simplexDelta7 = ReadXMLStringAttribut(
"SIMPLEXDELTA7", atts);
693 double simpDel7 = atof(simplexDelta7.c_str());
694 optimizerValues[8] = simpDel7;
695 std::string simplexDelta8 = ReadXMLStringAttribut(
"SIMPLEXDELTA8", atts);
696 double simpDel8 = atof(simplexDelta8.c_str());
697 optimizerValues[9] = simpDel8;
698 std::string simplexDelta9 = ReadXMLStringAttribut(
"SIMPLEXDELTA9", atts);
699 double simpDel9 = atof(simplexDelta9.c_str());
700 optimizerValues[10] = simpDel9;
701 std::string simplexDelta10 = ReadXMLStringAttribut(
"SIMPLEXDELTA10", atts);
702 double simpDel10 = atof(simplexDelta10.c_str());
703 optimizerValues[11] = simpDel10;
704 std::string simplexDelta11 = ReadXMLStringAttribut(
"SIMPLEXDELTA11", atts);
705 double simpDel11 = atof(simplexDelta11.c_str());
706 optimizerValues[12] = simpDel11;
707 std::string simplexDelta12 = ReadXMLStringAttribut(
"SIMPLEXDELTA12", atts);
708 double simpDel12 = atof(simplexDelta12.c_str());
709 optimizerValues[13] = simpDel12;
710 std::string simplexDelta13 = ReadXMLStringAttribut(
"SIMPLEXDELTA13", atts);
711 double simpDel13 = atof(simplexDelta13.c_str());
712 optimizerValues[14] = simpDel13;
713 std::string simplexDelta14 = ReadXMLStringAttribut(
"SIMPLEXDELTA14", atts);
714 double simpDel14 = atof(simplexDelta14.c_str());
715 optimizerValues[15] = simpDel14;
716 std::string simplexDelta15 = ReadXMLStringAttribut(
"SIMPLEXDELTA15", atts);
717 double simpDel15 = atof(simplexDelta15.c_str());
718 optimizerValues[16] = simpDel15;
719 std::string simplexDelta16 = ReadXMLStringAttribut(
"SIMPLEXDELTA16", atts);
720 double simpDel16 = atof(simplexDelta16.c_str());
721 optimizerValues[17] = simpDel16;
722 std::string parametersConvergenceTolerance = ReadXMLStringAttribut(
"PARAMETERSCONVERGENCETOLERANCE", atts);
723 double paramConv = atof(parametersConvergenceTolerance.c_str());
724 optimizerValues[18] = paramConv;
725 std::string functionConvergenceTolerance = ReadXMLStringAttribut(
"FUNCTIONCONVERGENCETOLERANCE", atts);
726 double funcConv = atof(functionConvergenceTolerance.c_str());
727 optimizerValues[19] = funcConv;
728 std::string numberIterations = ReadXMLStringAttribut(
"NUMBERITERATIONS", atts);
729 double numIt = atof(numberIterations.c_str());
730 optimizerValues[20] = numIt;
737 std::string GradientConvergenceTolerance = ReadXMLStringAttribut(
"GRADIENTCONVERGENCETOLERANCE", atts);
738 double graConTo = atof(GradientConvergenceTolerance.c_str());
739 optimizerValues[2] = graConTo;
740 std::string lineSearchAccuracy = ReadXMLStringAttribut(
"LINESEARCHACCURACY", atts);
741 double lineSearch = atof(lineSearchAccuracy.c_str());
742 optimizerValues[3] = lineSearch;
743 std::string defaultStepLength = ReadXMLStringAttribut(
"DEFAULTSTEPLENGTH", atts);
744 double defStep = atof(defaultStepLength.c_str());
745 optimizerValues[4] = defStep;
746 std::string numberIterations = ReadXMLStringAttribut(
"NUMBERITERATIONS", atts);
747 double numIt = atof(numberIterations.c_str());
748 optimizerValues[5] = numIt;
749 std::string useTrace = ReadXMLStringAttribut(
"USETRACE", atts);
750 double useTr = atof(useTrace.c_str());
751 optimizerValues[6] = useTr;
755 std::string a = ReadXMLStringAttribut(
"a", atts);
756 double a1 = atof(a.c_str());
757 optimizerValues[2] = a1;
758 std::string a2 = ReadXMLStringAttribut(
"A", atts);
759 double a3 = atof(a2.c_str());
760 optimizerValues[3] = a3;
761 std::string alpha = ReadXMLStringAttribut(
"ALPHA", atts);
762 double alp = atof(alpha.c_str());
763 optimizerValues[4] = alp;
764 std::string c = ReadXMLStringAttribut(
"c", atts);
765 double c1 = atof(c.c_str());
766 optimizerValues[5] = c1;
767 std::string gamma = ReadXMLStringAttribut(
"GAMMA", atts);
768 double gam = atof(gamma.c_str());
769 optimizerValues[6] = gam;
770 std::string tolerance = ReadXMLStringAttribut(
"TOLERANCE", atts);
771 double tol = atof(tolerance.c_str());
772 optimizerValues[7] = tol;
773 std::string stateOfConvergenceDecayRate = ReadXMLStringAttribut(
"STATEOFCONVERGENCEDECAYRATE", atts);
774 double stateOfConvergence = atof(stateOfConvergenceDecayRate.c_str());
775 optimizerValues[8] = stateOfConvergence;
776 std::string minNumberIterations = ReadXMLStringAttribut(
"MINNUMBERITERATIONS", atts);
777 double minNumIt = atof(minNumberIterations.c_str());
778 optimizerValues[9] = minNumIt;
779 std::string numberPerturbations = ReadXMLStringAttribut(
"NUMBERPERTURBATIONS", atts);
780 double numPer = atof(numberPerturbations.c_str());
781 optimizerValues[10] = numPer;
782 std::string numberIterations = ReadXMLStringAttribut(
"NUMBERITERATIONS", atts);
783 double numIt = atof(numberIterations.c_str());
784 optimizerValues[11] = numIt;
786 return optimizerValues;
789 itk::Array<double> RigidRegistrationPreset::loadInterpolatorValues(
790 itk::Array<double> interpolatorValues )
792 return interpolatorValues;
bool newPresets(std::map< std::string, itk::Array< double >> newTransformValues, std::map< std::string, itk::Array< double >> newMetricValues, std::map< std::string, itk::Array< double >> newOptimizerValues, std::map< std::string, itk::Array< double >> newInterpolatorValues, std::string fileName="")
Saves new presets in the previous opened xml file or in the new fileName location.
bool LoadPreset()
Tries to find mitkRigidRegistrationPresets.xml in /mitk/Config and loads all presets stored in this f...
std::map< std::string, itk::Array< double > > & getInterpolatorValuesPresets()
Returns a map with all preset names and their according interpolator values as an array...
std::map< std::string, itk::Array< double > > & getMetricValuesPresets()
Returns a map with all preset names and their according metric values as an array.
DataCollection - Class to facilitate loading/accessing structured data.
std::list< std::string > & getAvailablePresets()
Module * GetModule() const
std::map< std::string, itk::Array< double > > & getOptimizerValuesPresets()
Returns a map with all preset names and their according optimizer values as an array.
itk::Array< double > getInterpolatorValues(std::string name)
Returns an array including all interpolator values belonging to preset name.
~RigidRegistrationPreset()
RigidRegistrationPreset()
MITKCORE_EXPORT const ScalarType eps
MITKMATCHPOINTREGISTRATION_EXPORT ResultImageType::Pointer map(const InputImageType *input, const RegistrationType *registration, bool throwOnOutOfInputAreaError=false, const double &paddingValue=0, const ResultImageGeometryType *resultGeometry=NULL, bool throwOnMappingError=true, const double &errorValue=0, mitk::ImageMappingInterpolator::Type interpolatorType=mitk::ImageMappingInterpolator::Linear)
itk::Array< double > getMetricValues(std::string name)
Returns an array including all all metric values belonging to preset name.
std::map< std::string, itk::Array< double > > & getTransformValuesPresets()
Returns a map with all preset names and their according transform values as an array.
itk::Array< double > getTransformValues(std::string name)
Returns an array including all all transform values belonging to preset name.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
itk::Array< double > getOptimizerValues(std::string name)
Returns an array including all all optimizer values belonging to preset name.