VTK/VTK6/Migration/WikiExamples: Difference between revisions

From KitwarePublic
< VTK
Jump to navigationJump to search
Line 72: Line 72:
#else
#else
   sourceMapper->SetInputData(source);
   sourceMapper->SetInputData(source);
#endif
</pre>
<pre>
#if VTK_MAJOR_VERSION <= 5
  image->SetNumberOfScalarComponents(1);
  image->SetScalarTypeToInt();
#else
  image->AllocateScalars(VTK_INT,1);
#endif
</pre>
<pre>
#if VTK_MAJOR_VERSION <= 5
  imageClip->SetOutputWholeExtent(jPEGReader->GetOutput()->GetWholeExtent());
#else
  jPEGReader->UpdateInformation();
  imageClip->SetOutputWholeExtent(
    jPEGReader->GetOutputInformation(0)->Get(
      vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));
#endif
#endif
</pre>
</pre>

Revision as of 19:37, 17 January 2012

VTK6 represents a major upgrade to VTK. VTK6 makes several API changes and also removes some deprecated API's.

This experiment measures the impact of VTK6 API changes to the VTK Wiki Examples.

This experiment uses the DMAIC methodology of the Six Sigma management process to "Define", "Measure", "Analyze", "Improve" and "Control" valgrind defects in VTK.

The basic methodology (from Wikipedia) consists of the following five steps:

  • Define process goals that are consistent with customer demands and VTK's strategy.
  • Measure key aspects of the current process and collect relevant data.
  • Analyze the data to verify cause-and-effect relationships. Determine what the relationships are, and attempt to ensure that all factors have been considered.
  • Improve or optimize the process.
  • Control to ensure that any deviations from target are corrected before they result in defects. Set up pilot runs to establish software quality, move on to production, set up control mechanisms and continuously monitor the process.

Define

Convert the VTK Wiki Examples to VTK6 while still maintaining VTK5 compatibility.

Measure

As part of NA-MIC Project Week, the VTK Wiki Examples were built against VTK6. There are 595 wiki examples.

  • 661 compilation errors
  • 303 files had errors

Analyze

The VTK6 API changes accounted for 349 errors. The errors included the following:

  • 380 SetInput missing
    • about 100 of these were due to using SetInput/GetOutput rather than SetInputConnection/GetOutputPort
  • 138 GetProducerPort missing
  • 51 AllocateScalars missing
  • 23 Add Input missing
  • 11 SetSource missing
  • 6 Update missing
  • 4 SetStencil missing
  • 4 SetVectorInput missing
  • 2 SetMagnitudeInput missing
  • 2 SetImageInput missing
  • 2 GetWholeExtent missing
  • 2 vtkPLOT3DReader missing

Improve

303 files were manually edited. API changes were surrounded by

#if VTK_MAJOR_VERSION <= 5
 VTK5 code...
#else
 VTK6 code...
#endif
#if VTK_MAJOR_VERSION <= 5
  delaunay->SetInput(aPolyData);
  delaunay->SetSource(boundary);
#else
  delaunay->SetInputData(aPolyData);
  delaunay->SetSourceData(boundary);
#endif
#if VTK_MAJOR_VERSION <= 5
  appendFilter->AddInput(polydata);
  appendFilter->AddInput(ug);
#else
  appendFilter->AddInputData(polydata);
  appendFilter->AddInputData(ug);
#endif
#if VTK_MAJOR_VERSION <= 5
  sourceMapper->SetInputConnection(source->GetProducerPort());
#else
  sourceMapper->SetInputData(source);
#endif
#if VTK_MAJOR_VERSION <= 5
  image->SetNumberOfScalarComponents(1);
  image->SetScalarTypeToInt();
#else
  image->AllocateScalars(VTK_INT,1);
#endif
#if VTK_MAJOR_VERSION <= 5
  imageClip->SetOutputWholeExtent(jPEGReader->GetOutput()->GetWholeExtent());
#else
  jPEGReader->UpdateInformation();
  imageClip->SetOutputWholeExtent(
    jPEGReader->GetOutputInformation(0)->Get(
      vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()));
#endif

Control

Once the changes are reflected on the Wiki, a nightly dashboard built against VTK6 will catch any new API change issues.