PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
PatternLocTest.cxx
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2 Program: Plus
3 Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4 See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #include "PlusConfigure.h"
8 
11 #include "igsioTrackedFrame.h"
12 #include "vtkIGSIOSequenceIO.h"
13 #include "vtkSmartPointer.h"
14 #include "vtkIGSIOTrackedFrameList.h"
15 #include "vtkXMLDataElement.h"
16 #include "vtkXMLUtilities.h"
17 #include "vtksys/CommandLineArguments.hxx"
18 #include <fstream>
19 #include <iostream>
20 #include <sstream>
21 
23 // Other constants
24 
25 static const int MAX_FIDUCIAL_COUNT = 50;
26 
27 static const double FIDUCIAL_POSITION_TOLERANCE = 0.1; // in pixel
28 // Acceptance criteria for fiducial candidate (if the distance from the
29 // real fiducial position is less than segParams.then the fiducial is considered to be
30 // found).
31 static const double BASELINE_TO_ALGORITHM_TOLERANCE = 5;
33 
34 void SegmentImageSequence(vtkIGSIOTrackedFrameList* trackedFrameList, std::ofstream& outFile, const std::string& inputTestcaseName, const std::string& inputImageSequenceFileName, PlusFidPatternRecognition& patternRecognition, const char* fidPositionOutputFilename)
35 {
36  double sumFiducialNum = 0;// divide by framenum
37  double sumFiducialCandidate = 0;// divide by framenum
38 
39  bool writeFidPositionsToFile = (fidPositionOutputFilename != NULL);
40  std::ofstream outFileFidPositions;
41  if (writeFidPositionsToFile)
42  {
43  outFileFidPositions.open(fidPositionOutputFilename);
44  outFileFidPositions << "Frame number, Unfiltered timestamp, Timestamp, w1x, w1y, w2x, w2y, w3x, w3y, w4x, w4y, w5x, w5y, w6x, w6y " << std::endl;
45  }
46 
47  // Set to false if you don't want images produced after each morphological operation
48  bool debugOutput = vtkPlusLogger::Instance()->GetLogLevel() >= vtkPlusLogger::LOG_LEVEL_TRACE;
49  patternRecognition.GetFidSegmentation()->SetDebugOutput(debugOutput);
50 
51  for (unsigned int currentFrameIndex = 0; currentFrameIndex < trackedFrameList->GetNumberOfTrackedFrames(); currentFrameIndex++)
52  {
53  LOG_DEBUG("Frame: " << currentFrameIndex);
54 
55  std::ostringstream possibleFiducialsImageFilename;
56  possibleFiducialsImageFilename << inputTestcaseName << std::setw(3) << std::setfill('0') << currentFrameIndex << ".bmp" << std::ends;
57 
60 
61  if (trackedFrameList->GetTrackedFrame(currentFrameIndex)->GetImageData()->GetVTKScalarPixelType() != VTK_UNSIGNED_CHAR)
62  {
63  LOG_ERROR("UsFidSegTest only supports 8-bit images");
64  continue;
65  }
66  patternRecognition.RecognizePattern(trackedFrameList->GetTrackedFrame(currentFrameIndex), segResults, error, currentFrameIndex);
67 
68  sumFiducialCandidate += segResults.GetNumDots();
69  int numFid = 0;
70  for (unsigned int fidPosition = 0; fidPosition < segResults.GetFoundDotsCoordinateValue().size(); fidPosition++)
71  {
72  std::vector<double> currentFid = segResults.GetFoundDotsCoordinateValue()[fidPosition];
73  if (currentFid[0] != 0 || currentFid[1] != 0)
74  {
75  numFid++;
76  }
77  }
78  sumFiducialNum = sumFiducialNum + numFid;
79 
80  if (writeFidPositionsToFile)
81  {
82 
83  std::string strFrameNumber = trackedFrameList->GetTrackedFrame(currentFrameIndex)->GetFrameField("FrameNumber");
84  std::string strTimestamp = trackedFrameList->GetTrackedFrame(currentFrameIndex)->GetFrameField("Timestamp");
85  std::string strUnfilteredTimestamp = trackedFrameList->GetTrackedFrame(currentFrameIndex)->GetFrameField("UnfilteredTimestamp");
86 
87  outFileFidPositions << (!strFrameNumber.empty() ? strFrameNumber : "unknown") << ", " << (!strUnfilteredTimestamp.empty() ? strUnfilteredTimestamp : "unknown") << ", " << (!strTimestamp.empty() ? strTimestamp : "unknown");
88  for (unsigned int fidPosition = 0; fidPosition < segResults.GetFoundDotsCoordinateValue().size(); fidPosition++)
89  {
90  std::vector<double> currentFid = segResults.GetFoundDotsCoordinateValue()[fidPosition];
91  outFileFidPositions << ", " << currentFid[0] << ", " << currentFid[1];
92  }
93  outFileFidPositions << std::endl;
94  }
95 
96  PlusUsFidSegResultFile::WriteSegmentationResults(outFile, segResults, inputTestcaseName, currentFrameIndex, inputImageSequenceFileName);
97 
98  if (vtkPlusLogger::Instance()->GetLogLevel() >= vtkPlusLogger::LOG_LEVEL_DEBUG)
99  {
100  PlusUsFidSegResultFile::WriteSegmentationResults(std::cout, segResults, inputTestcaseName, currentFrameIndex, inputImageSequenceFileName);
101  }
102  }
103 
104  double meanFid = sumFiducialNum / trackedFrameList->GetNumberOfTrackedFrames();
105  double meanFidCandidate = sumFiducialCandidate / trackedFrameList->GetNumberOfTrackedFrames();
106  PlusUsFidSegResultFile::WriteSegmentationResultsStats(outFile, meanFid, meanFidCandidate);
107 
108  if (writeFidPositionsToFile)
109  {
110  outFileFidPositions.close();
111  }
112 }
113 
114 // return the number of differences
115 int CompareSegmentationResults(const std::string& inputBaselineFileName, const std::string& outputTestResultsFileName, PlusFidPatternRecognition& patternRecognition)
116 {
117  const bool reportWarningsAsFailure = true;
118  int numberOfFailures = 0;
119 
120  vtkSmartPointer<vtkXMLDataElement> currentRootElem = vtkSmartPointer<vtkXMLDataElement>::Take(
121  vtkXMLUtilities::ReadElementFromFile(outputTestResultsFileName.c_str()));
122  vtkSmartPointer<vtkXMLDataElement> baselineRootElem = vtkSmartPointer<vtkXMLDataElement>::Take(
123  vtkXMLUtilities::ReadElementFromFile(inputBaselineFileName.c_str()));
124 
125  bool writeFidFoundRatioToFile = vtkPlusLogger::Instance()->GetLogLevel() >= vtkPlusLogger::LOG_LEVEL_TRACE;
126 
127  // check to make sure we have the right element
128  if (baselineRootElem == NULL)
129  {
130  LOG_ERROR("Reading baseline data file failed: " << inputBaselineFileName);
131  numberOfFailures++;
132  return numberOfFailures;
133  }
134  if (currentRootElem == NULL)
135  {
136  LOG_ERROR("Reading newly generated data file failed: " << outputTestResultsFileName);
137  numberOfFailures++;
138  return numberOfFailures;
139  }
140 
141  if (strcmp(baselineRootElem->GetName(), PlusUsFidSegResultFile::TEST_RESULTS_ELEMENT_NAME) != 0)
142  {
143  LOG_ERROR("Baseline data file is invalid");
144  numberOfFailures++;
145  return numberOfFailures;
146  }
147  if (strcmp(currentRootElem->GetName(), PlusUsFidSegResultFile::TEST_RESULTS_ELEMENT_NAME) != 0)
148  {
149  LOG_ERROR("newly generated data file is invalid");
150  numberOfFailures++;
151  return numberOfFailures;
152  }
153 
154  std::ofstream outFileFidFindingResults;
155  if (writeFidFoundRatioToFile)
156  {
157  outFileFidFindingResults.open("FiducialsFound.txt");
158  outFileFidFindingResults << "Baseline to algorithm Tolerance: " << BASELINE_TO_ALGORITHM_TOLERANCE << " pixel(s)" << std::endl;
159  outFileFidFindingResults << "Threshold: " << patternRecognition.GetFidSegmentation()->GetThresholdImagePercent() << std::endl;
160  }
161  for (int nestedElemInd = 0; nestedElemInd < currentRootElem->GetNumberOfNestedElements(); nestedElemInd++)
162  {
163  LOG_DEBUG("Current Frame: " << nestedElemInd);
164  vtkXMLDataElement* currentElem = currentRootElem->GetNestedElement(nestedElemInd);
165  if (currentElem == NULL)
166  {
167  LOG_WARNING("Frame " << nestedElemInd << ": Invalid current data element");
168  if (reportWarningsAsFailure)
169  {
170  numberOfFailures++;
171  }
172  continue;
173  }
174  if (strcmp(currentElem->GetName(), PlusUsFidSegResultFile::TEST_CASE_ELEMENT_NAME) != 0)
175  {
176  // ignore all non-test-case elements
177  continue;
178  }
179 
180  if (currentElem->GetAttribute(PlusUsFidSegResultFile::ID_ATTRIBUTE_NAME) == NULL)
181  {
182  LOG_WARNING("Frame " << nestedElemInd << ": Current data element doesn't have an id");
183  if (reportWarningsAsFailure)
184  {
185  numberOfFailures++;
186  }
187  continue;
188  }
189 
190  LOG_DEBUG("Comparing " << currentElem->GetAttribute(PlusUsFidSegResultFile::ID_ATTRIBUTE_NAME));
191 
192  vtkXMLDataElement* baselineElem = baselineRootElem->FindNestedElementWithNameAndId(PlusUsFidSegResultFile::TEST_CASE_ELEMENT_NAME, currentElem->GetId());
193 
194  if (baselineElem == NULL)
195  {
196  LOG_ERROR("Frame " << nestedElemInd << ": Cannot find corresponding baseline element for current element " << currentElem->GetId());
197  numberOfFailures++;
198  continue;
199  }
200 
201  if (strcmp(baselineElem->GetName(), PlusUsFidSegResultFile::TEST_CASE_ELEMENT_NAME) != 0)
202  {
203  LOG_WARNING("Frame " << nestedElemInd << ": Test case name mismatch");
204  if (reportWarningsAsFailure) { numberOfFailures++; }
205  continue;
206  }
207 
208  vtkXMLDataElement* outputElementBaseline = baselineElem->FindNestedElementWithName("Output");
209  vtkXMLDataElement* outputElementCurrent = currentElem->FindNestedElementWithName("Output");
210  const int MAX_FIDUCIAL_COORDINATE_COUNT = MAX_FIDUCIAL_COUNT * 2;
211 
212  int baselineSegmentationSuccess = 0;
213  int currentSegmentationSuccess = 0;
214  if (!outputElementBaseline->GetScalarAttribute("SegmentationSuccess", baselineSegmentationSuccess))
215  {
216  LOG_ERROR("Frame " << nestedElemInd << ": baseline segmentation success is missing");
217  numberOfFailures++;
218  }
219  if (!outputElementCurrent->GetScalarAttribute("SegmentationSuccess", currentSegmentationSuccess))
220  {
221  LOG_ERROR("Frame " << nestedElemInd << ": current segmentation success is missing");
222  numberOfFailures++;
223  }
224 
225  if (baselineSegmentationSuccess != currentSegmentationSuccess)
226  {
227  LOG_ERROR("Frame " << nestedElemInd << ": SegmentationSuccess mismatch: current=" << currentSegmentationSuccess << ", baseline=" << baselineSegmentationSuccess);
228  numberOfFailures++;
229  }
230 
231  if (!baselineSegmentationSuccess)
232  {
233  // there is no baseline data, so we cannot do any more comparison
234  continue;
235  }
236 
237  double baselineFiducialPoints[MAX_FIDUCIAL_COORDINATE_COUNT]; // baseline fiducial Points
238  memset(baselineFiducialPoints, 0, sizeof(baselineFiducialPoints[0] * MAX_FIDUCIAL_COORDINATE_COUNT));
239  int baselineFidPointsRead = outputElementBaseline->GetVectorAttribute("SegmentationPoints", MAX_FIDUCIAL_COORDINATE_COUNT, baselineFiducialPoints);
240 
241  // Count how many baseline fiducials are detected as fiducial candidates
242  vtkXMLDataElement* fidCandidElement = currentElem->FindNestedElementWithName("FiducialPointCandidates");
243  const char* fidCandid = "FiducialPointCandidates";
244  if ((fidCandidElement != NULL) && (strcmp(fidCandidElement->GetName(), fidCandid) == 0))
245  {
246  int foundBaselineFiducials = 0;
247 
248  for (int b = 0; b + 1 < baselineFidPointsRead; b += 2) // loop through baseline fiducials
249  {
250  for (int i = 0; i < fidCandidElement->GetNumberOfNestedElements(); i++) // loop through all found potential fiducials
251  {
252  double fidCandidates[2] = {0, 0};
253  fidCandidElement->GetNestedElement(i)->GetVectorAttribute("Positon", 2, fidCandidates);
254 
255  if (fabs(baselineFiducialPoints[b] - fidCandidates[0]) < BASELINE_TO_ALGORITHM_TOLERANCE
256  && fabs(baselineFiducialPoints[b + 1] - fidCandidates[1]) < BASELINE_TO_ALGORITHM_TOLERANCE)
257  {
258  LOG_DEBUG("Fiducial candidate (" << fidCandidates[0] << ", " << fidCandidates[1]
259  << ") matches the segmented baseline fiducial (" << baselineFiducialPoints[b] << ", " << baselineFiducialPoints[b + 1] << ")");
260  foundBaselineFiducials++;
261  break;
262  }
263 
264  }
265  }
266 
267  LOG_DEBUG("Found fiducials / Fiducial candidates: " << foundBaselineFiducials << " / " << fidCandidElement->GetNumberOfNestedElements()) ;
268  if (writeFidFoundRatioToFile)
269  {
270  outFileFidFindingResults << nestedElemInd << ": " << foundBaselineFiducials << " / " << fidCandidElement->GetNumberOfNestedElements() << std::endl;
271  }
272  }
273 
274  if (!currentSegmentationSuccess)
275  {
276  // the current segmentation was not successful, so we cannot do any more comparison
277  continue;
278  }
279 
280  double baselineIntensity = 0;
281  double testingElementIntensity = 0;
282  if (!outputElementBaseline->GetScalarAttribute("SegmentationQualityInIntensityScore", baselineIntensity))
283  {
284  LOG_ERROR("Frame " << nestedElemInd << ": Cannot access baseline scalar");
285  numberOfFailures++;
286  }
287  else if (!outputElementCurrent->GetScalarAttribute("SegmentationQualityInIntensityScore", testingElementIntensity))
288  {
289  LOG_ERROR("Frame " << nestedElemInd << ": Newly generated segmentation intensity is missing");
290  numberOfFailures++;
291  }
292  else
293  {
294 
295  if (fabs(baselineIntensity - testingElementIntensity) > FIDUCIAL_POSITION_TOLERANCE)
296  {
297  LOG_ERROR("Frame " << nestedElemInd << ": Intensity mismatch: current=" << testingElementIntensity << ", baseline=" << baselineIntensity);
298  numberOfFailures++;
299  }
300  }
301 
302  double fiducialPositions[MAX_FIDUCIAL_COORDINATE_COUNT];
303  memset(fiducialPositions, 0, sizeof(fiducialPositions[0])*MAX_FIDUCIAL_COORDINATE_COUNT);
304  int fidCoordinatesRead = outputElementCurrent->GetVectorAttribute("SegmentationPoints", MAX_FIDUCIAL_COORDINATE_COUNT, fiducialPositions);
305 
306  if (baselineFidPointsRead != fidCoordinatesRead)
307  {
308  LOG_ERROR("Frame " << nestedElemInd << ": Number of current fiducials (" << fidCoordinatesRead << ") differs from the number of baseline fiducials (" << baselineFidPointsRead << ")");
309  numberOfFailures++;
310  }
311  int fidCount = std::min(baselineFidPointsRead, fidCoordinatesRead);
312 
313  if (baselineFidPointsRead < 1)
314  {
315  LOG_ERROR("Frame " << nestedElemInd << ": Cannot access baseline fiducial points");
316  numberOfFailures++;
317  }
318  else if (fidCoordinatesRead < 1)
319  {
320  LOG_ERROR("Frame " << nestedElemInd << ": Newly generated segmentation points are missing");
321  numberOfFailures++;
322  }
323  else if (baselineFidPointsRead % 2 != 0)
324  {
325  LOG_ERROR("Frame " << nestedElemInd << ": Unpaired baseline fiducial coordinates");
326  numberOfFailures++;
327  }
328  else if (fidCoordinatesRead % 2 != 0)
329  {
330  LOG_ERROR("Frame " << nestedElemInd << ": Unpaired Fiducial Coordinates");
331  numberOfFailures++;
332  }
333  else if (baselineFidPointsRead > MAX_FIDUCIAL_COORDINATE_COUNT)
334  {
335  LOG_WARNING("Frame " << nestedElemInd << ": Too many baseline fiducials");
336  if (reportWarningsAsFailure) { numberOfFailures++; }
337  }
338  else if (fidCoordinatesRead > MAX_FIDUCIAL_COORDINATE_COUNT)
339  {
340  LOG_WARNING("Frame " << nestedElemInd << ": Too many Fiducials");
341  if (reportWarningsAsFailure) { numberOfFailures++; }
342  }
343 
344  else
345  {
346  //LOG_ERROR("Coordinate mismatch on frame: "<<nestedElemInd);
347  for (int traverseFiducials = 0; traverseFiducials < fidCount; ++traverseFiducials)
348  {
349  if (fabs(fiducialPositions[traverseFiducials] - baselineFiducialPoints[traverseFiducials]) > FIDUCIAL_POSITION_TOLERANCE)
350  {
351  LOG_ERROR("Frame " << nestedElemInd << ": Fiducial coordinate [" << traverseFiducials << "] mismatch: current=" << fiducialPositions[traverseFiducials] << ", baseline=" << baselineFiducialPoints[traverseFiducials]);
352  numberOfFailures++;
353  }
354  }
355  }
356 
357  }
358 
359  std::cout << numberOfFailures << std::endl;
360 
361  if (writeFidFoundRatioToFile)
362  {
363  outFileFidFindingResults.close();
364  }
365  return numberOfFailures;
366 }
367 
368 int main(int argc, char** argv)
369 {
370 
371  std::string inputImageSequenceFileName;
372  std::string inputBaselineFileName;
373  std::string inputTestcaseName;
374  std::string inputTestDataDir;
375  std::string inputConfigFileName;
376  std::string outputTestResultsFileName;
377  std::string outputFiducialPositionsFileName;
378  std::string fiducialGeomString;
379 
380  int verboseLevel = vtkPlusLogger::LOG_LEVEL_UNDEFINED;
381 
382  vtksys::CommandLineArguments args;
383  args.Initialize(argc, argv);
384 
385  args.AddArgument("--test-data-dir", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &inputTestDataDir, "Test data directory");
386  args.AddArgument("--img-seq-file", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &inputImageSequenceFileName, "Filename of the input image sequence. Segmentation will be performed for all frames of the sequence.");
387  args.AddArgument("--testcase", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &inputTestcaseName, "Name of the test case that will be printed to the output");
388  args.AddArgument("--baseline", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &inputBaselineFileName, "Name of file storing baseline results (fiducial coordinates, intensity, angle)");
389 
390  args.AddArgument("--output-xml-file", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &outputTestResultsFileName, "Name of file storing results of a new segmentation (fiducial coordinates, intensity, angle)");
391  args.AddArgument("--output-fiducial-positions-file", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &outputFiducialPositionsFileName, "Name of file for storing fiducial positions in time");
392 
393  args.AddArgument("--config-file", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &inputConfigFileName, "Calibration configuration file name");
394 
395  args.AddArgument("--verbose", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &verboseLevel, "Verbose level (1=error only, 2=warning, 3=info, 4=debug, 5=trace)");
396 
397  if (!args.Parse())
398  {
399  std::cerr << "Problem parsing arguments" << std::endl;
400  std::cout << "Help: " << args.GetHelp() << std::endl;
401  exit(EXIT_FAILURE);
402  }
403 
404  vtkPlusLogger::Instance()->SetLogLevel(verboseLevel);
405 
406  if (inputImageSequenceFileName.empty() || inputConfigFileName.empty())
407  {
408  std::cerr << "At lease one of the following parameters is missing: --img-seq-file, --config-file" << std::endl;
409  exit(EXIT_FAILURE);
410  }
411 
412  // Read configuration
413  vtkSmartPointer<vtkXMLDataElement> configRootElement = vtkSmartPointer<vtkXMLDataElement>::New();
414  if (PlusXmlUtils::ReadDeviceSetConfigurationFromFile(configRootElement, inputConfigFileName.c_str()) == PLUS_FAIL)
415  {
416  LOG_ERROR("Unable to read configuration from file " << inputConfigFileName.c_str());
417  return EXIT_FAILURE;
418  }
419 
420  PlusFidPatternRecognition patternRecognition;
421  patternRecognition.ReadConfiguration(configRootElement);
422 
423  LOG_INFO("Read from metafile");
424  std::string inputImageSequencePath = inputTestDataDir + "/" + inputImageSequenceFileName;
425  vtkSmartPointer<vtkIGSIOTrackedFrameList> trackedFrameList = vtkSmartPointer<vtkIGSIOTrackedFrameList>::New();
426  if (vtkIGSIOSequenceIO::Read(inputImageSequencePath, trackedFrameList) != PLUS_SUCCESS)
427  {
428  LOG_ERROR("Failed to read sequence metafile: " << inputImageSequencePath);
429  return EXIT_FAILURE;
430  }
431 
432  std::ofstream outFile;
433  outFile.open(outputTestResultsFileName.c_str(), ios::trunc);
434 
435  if (! outFile.is_open())
436  {
437  LOG_ERROR("Failed to open file: " << outputTestResultsFileName);
438  return EXIT_FAILURE;
439  }
440 
442  PlusUsFidSegResultFile::WriteSegmentationResultsParameters(outFile, patternRecognition, "");
443 
444  const char* fidPositionOutputFilename = NULL;
445  if (!outputFiducialPositionsFileName.empty())
446  {
447  fidPositionOutputFilename = outputFiducialPositionsFileName.c_str();
448  }
449 
450  LOG_INFO("Segment image sequence");
451  SegmentImageSequence(trackedFrameList.GetPointer(), outFile, inputTestcaseName, inputImageSequenceFileName, patternRecognition, fidPositionOutputFilename);
452 
454  outFile.close();
455 
456  LOG_DEBUG("Done!");
457 
458  if (!inputBaselineFileName.empty())
459  {
460  LOG_INFO("Compare results");
461  if (CompareSegmentationResults(inputBaselineFileName, outputTestResultsFileName, patternRecognition) != 0)
462  {
463  LOG_ERROR("Comparison of segmentation data to baseline failed");
464  return EXIT_FAILURE;
465  }
466  }
467 
468  return EXIT_SUCCESS;
469 }
static void WriteSegmentationResultsFooter(std::ostream &outFile)
PlusFidSegmentation * GetFidSegmentation()
static void WriteSegmentationResultsParameters(std::ostream &outFile, PlusFidPatternRecognition &patternRcognitionObject, const std::string &trueFidFileName)
static void WriteSegmentationResults(std::ostream &outFile, PlusPatternRecognitionResult &segResults, const std::string &inputTestcaseName, int currentFrameIndex, const std::string &inputImageSequenceFileName)
for i
#define PLUS_FAIL
Definition: PlusCommon.h:43
static const char * TEST_CASE_ELEMENT_NAME
Initial rotation matrix b
Definition: algo3.m:25
static const double BASELINE_TO_ALGORITHM_TOLERANCE
std::vector< std::vector< double > > & GetFoundDotsCoordinateValue()
#define PLUS_SUCCESS
Definition: PlusCommon.h:44
void SetDebugOutput(bool value)
static const double FIDUCIAL_POSITION_TOLERANCE
static const int MAX_FIDUCIAL_COUNT
static vtkIGSIOLogger * Instance()
static const char * TEST_RESULTS_ELEMENT_NAME
static const char * ID_ATTRIBUTE_NAME
PlusStatus RecognizePattern(vtkIGSIOTrackedFrameList *trackedFrameList, PatternRecognitionError &patternRecognitionError, int *numberOfSuccessfullySegmentedImages=NULL, std::vector< unsigned int > *segmentedFramesIndices=NULL)
int CompareSegmentationResults(const std::string &inputBaselineFileName, const std::string &outputTestResultsFileName, PlusFidPatternRecognition &patternRecognition)
void SegmentImageSequence(vtkIGSIOTrackedFrameList *trackedFrameList, std::ofstream &outFile, const std::string &inputTestcaseName, const std::string &inputImageSequenceFileName, PlusFidPatternRecognition &patternRecognition, const char *fidPositionOutputFilename)
int main(int argc, char **argv)
static void WriteSegmentationResultsStats(std::ostream &outFile, double meanFid, double meanFidCandidate=-1)
static void WriteSegmentationResultsHeader(std::ostream &outFile)
PlusStatus ReadConfiguration(vtkXMLDataElement *rootConfigElement)
static PlusStatus ReadDeviceSetConfigurationFromFile(vtkXMLDataElement *config, const char *filename)
Definition: PlusXmlUtils.h:23