Difference between revisions of "2011 Winter Project Week: Slicer4-ITK4 Continuous Integration"

From NAMIC
Jump to: navigation, search
m (Text replacement - "http://www.slicer.org/slicerWiki/index.php/" to "https://www.slicer.org/wiki/")
 
(45 intermediate revisions by 3 users not shown)
Line 5: Line 5:
  
 
==Key Investigators==
 
==Key Investigators==
* Bill Lorensen
+
* Bill Lorensen - Noware
* Hans - Iowa
 
 
* Luis - Kitware
 
* Luis - Kitware
 +
* Mark Scully (Kent Williams/Hans Johnson) - Iowa
  
 
<div style="margin: 20px;">
 
<div style="margin: 20px;">
Line 13: Line 13:
  
 
<h3>Objective</h3>
 
<h3>Objective</h3>
Identify API changes in ITK4 that cause compilation or run-time errors in Slicer4.
+
Identify API changes in ITK4 that cause compilation or run-time errors in Slicer4. NA-MIC is a major customer of the insight Toolkit, ITK. It is critical that ITK developers understand the impact of API changes on customers. As part of the ITKv4 contract Slicer3 will be one of the [http://batchmake.org/Wiki/ITK_Release_4/Migration_Plan/Phases#Phase-I:_Sequestering_Reference_Applications sequestered applications]. This project goes beyond that and will continuously integrate Slicer4 and ITK4.
  
Slicer4 development is underway and ITK version 4 has recently started. One of the goals of ITK 4 is too improve and cleanup the application programming interface (API). Although every attempt is being made to keep the API compatible with ITK 3.x. However, since ITKv4 will be a new major release, there are opportunities to remove antiquated code and repair long standing design defects.
+
Slicer4 development is under-way and ITK version 4 has recently started. One of the goals of ITK 4 is to improve, simplify and clean-up the application programming interface (API). Every attempt is being made to keep the API compatible with ITK 3.x.
  
The API changes may be planned or accidental. This project will establish mechanisms to discover, resolve and document API issues.
+
The API changes may be planned or accidental. This project will establish mechanisms to discover, resolve and document API issues that affect Slicer4. We expect that a similar process will be created for other major ITK customers.
 
</div>
 
</div>
  
Line 23: Line 23:
  
 
<h3>Approach, Plan</h3>
 
<h3>Approach, Plan</h3>
This project will use the [http://en.wikipedia.org/wiki/DMAIC#DMAIC '''DMAIC'''] methodology of the [http://en.wikipedia.org/wiki/Six_Sigma ''Six Sigma management process''] to ''"Define"'', ''"Measure"'', ''"Analyze"'', ''"Improve"'' and ''"Control"'' compiler warnings in Slicer3. This project will concentrate on warnings produced by the GNU gcc 4.3 compiler. Similar approaches can be applied to other Slicer3 compilers.
+
This project will use the [http://en.wikipedia.org/wiki/DMAIC#DMAIC '''DMAIC'''] methodology of the [http://en.wikipedia.org/wiki/Six_Sigma ''Six Sigma management process''] to ''"Define"'', ''"Measure"'', ''"Analyze"'', ''"Improve"'' and ''"Control"'' the integration of Slicer4 and ITK4.
  
 
The basic methodology (from Wikipedia) consists of the following five steps:
 
The basic methodology (from Wikipedia) consists of the following five steps:
Line 38: Line 38:
 
<h3>Progress</h3>
 
<h3>Progress</h3>
 
*'''''D'''efine''
 
*'''''D'''efine''
The goal is to provide a mechanism to identify incompatible Slicer4/ITK4 API changes.
+
** The goal is to provide a mechanism to identify, repair and document incompatible Slicer4/ITK4 API changes throughout the development of Slicer4 and ITK4.
 
*'''''M'''easure''
 
*'''''M'''easure''
A [http://www.cdash.org/CDash/index.php?project=Slicer4&date=2010-12-28&filtercount=1&showfilters=1&field1=site/string&compare1=63&value1=BillsBasement baseline dashboard] was created on December 27, 2010. There mere 605 compilation errors.
+
** A [http://www.cdash.org/CDash/index.php?project=Slicer4&date=2010-12-28&filtercount=1&showfilters=1&field1=site/string&compare1=63&value1=BillsBasement baseline dashboard] was created on December 27, 2010. There were 605 compilation errors.
 +
** Developer Instructions
 +
*** https://www.slicer.org/wiki/Slicer4
 +
*** Source code downloaded as:
 +
**** "svn co http://svn.slicer.org/Slicer4/trunk/"
 +
*** Build Instructions:
 +
**** [https://www.slicer.org/wiki/Slicer4_Build_instructions Build Instructions: SuperBuild]
 +
**** ccmake -DQT_QMAKE_EXECUTABLE:FILEPATH=/home/ibanez/bin/Qt/qtsdk-2010.05/qt/bin/qmake ~/src/NAMIC/Slicer4/SuperBuild
 +
*** Dasboard submissions:
 +
**** http://www.cdash.org/CDash/index.php?project=Slicer4
 +
**** Linux 64 bits (eldorado.kitware)
 +
**** Window 64 bits (redwall.kitware)
 
*'''''A'''nalyze''
 
*'''''A'''nalyze''
A description of each API incompatibility and how to address it will be provided.
+
**A description of each API incompatibility and how to address it will be provided.
 +
*** [http://itk.org/Wiki/ITK_Release_4/MigrationGuideDeveloperTutorial ITKv4 Migration Guide - Developer Tutorial]
 +
*** [http://itk.org/Wiki/ITK_Release_4/What_Developers_Must_Do_To_Contribute_to_the_Users_Migration_Guide What Developers Must Do To Contribute to the Users Migration Guide]
 +
*** [http://www.itk.org/Wiki/images/6/67/MigrationGuideFull.pdf Migration Guide Description PDF]
 +
*** [http://ij.itk.org/itkfaq/index.php? ITKv4 Migration Guide - Online Pages]
 
*'''''I'''mprove''
 
*'''''I'''mprove''
 +
** After some changes to Slicer4 and ITK4, we successfully build Slicer4 without any compile error. Here is the [http://www.cdash.org/CDash/viewTest.php?onlyfailed&buildid=821247 dashboard] that shows 10 test failures. During the week the failures were reduced to 5.
 
*'''''C'''ontrol''
 
*'''''C'''ontrol''
 +
** A Nightly Dashboard will be setup to continuously monitor any subsequent changes.
 
</div>
 
</div>
 
</div>
 
</div>
Line 51: Line 68:
  
  
==References==
+
 
* [[ITK_Release_4.0|The ITKv4 Wiki Page]]
 
* [[ITK_Release_4/MigrationGuideDeveloperTutorial|Developer Tutorial]]
 
* [[ITK_Release_4/What Developers Must Do To Contribute to the Users Migration Guide|What Developers Must Do To Contribute to the Users Migration Guide]]
 
* http://www.itk.org/Wiki/images/6/67/MigrationGuideFull.pdf
 
* [http://ij.itk.org/itkfaq/index.php? ITKv4 Migration Guide]
 
 
</div>
 
</div>
 
-->
 
-->
 +
 +
==Measure - ITK4 Changes that Affect Slicer4==
 +
Here we summarize the API change that caused Slicer4 to not compile or run incorrectly. For each API change we list the major classes affected, how the issue was resolved and whether the change is compatible with ITK3.x. We also include a pointer to the [http://ij.itk.org/itkfaq/index.php?|ITK Migration Guide] section that deals with the issue.
 +
{| border="1"
 +
! API Change
 +
! Classes Affected
 +
! Resolution
 +
! Works for ITK3
 +
! ITK Migration Doc
 +
|-
 +
|
 +
Remove OStringStream
 +
|
 +
Many
 +
|
 +
Replace OStringStream with std::stringstream
 +
|
 +
Yes
 +
|
 +
Nothing yet
 +
|-
 +
|
 +
Remove New method for Rigid3DTransform
 +
|
 +
vtkSlicerTransformLogic
 +
ResampleVolume2.cxx
 +
|
 +
Introduced ITKv3_COMPATIBILITY cmake variable that when ON, permits a New() on Rigid3DTransform. This mimics the old behaviour.
 +
|
 +
NA
 +
|
 +
Nothing yet
 +
|-
 +
|
 +
New Transform pure virtual methods
 +
|
 +
itkWarpTransform3D.h
 +
|
 +
Added itkExceptionMacro to each pure virtual method that was not implemented.
 +
|
 +
Yes
 +
|
 +
Nothing yet
 +
|-
 +
|
 +
Remove Brains2MaskImageIO
 +
|
 +
BRAINSTools
 +
|
 +
Skip building for ITKv4.  Mark Scully is nearly done with necessary refactorings.
 +
|
 +
Yes
 +
|
 +
Task assigned to Kent Williams
 +
|-
 +
|
 +
Upgrade GDCM to v2
 +
|
 +
DicomToNrrdConverter
 +
|
 +
Skip building for ITKv4. This will be upgraded to gdcm2. See other project week item: [[http://na-mic.org/Wiki/index.php/2011_Winter_Project_Week:DicomToNrrdRefactoring]]
 +
|
 +
NA
 +
|
 +
Not Yet
 +
|-
 +
|}
 +
==Measure - Test Failures==
 +
* DiffusionTensorEstimationTest floating point overflow
 +
** Nrrd floating point exception (expected)
 +
* DiffusionTensorMathematicsTest floating point overflow
 +
** Nrrd floating point exception (expected)
 +
* N4ITKBiasFieldCorrectionTest floating point zero divide
 +
** Fixed by Andri Fedorov. Slicer 3 upgraded to itkv4 version.
 +
** Needed new baseline
 +
* PolyDataToLabelmapTest small image error
 +
**  --compareNumberOfPixelsTolerance 20
 +
* RegisterImagesMultiResTest abort
 +
** Problems in regression testing.
 +
* ResampleDTI2RigidTransformsLinearTest small image error
 +
** 1 pixel difference. Added  --compareIntensityTolerance 1.
 +
* ResampleDTIBSplineWSInterpolationTest small image error
 +
** 1 pixel difference. Added  --compareIntensityTolerance 1.
 +
* ResampleVolume2BSplineWSInterpolationTest SetParameters exception
 +
** Fixed by Francois Budin
 +
* ResampleVolume2HFieldTest SetParameters exception
 +
** Fixed by Francois Budin
 +
* ResampleVolume2RotationNNTest segmentation violation
 +
** The WarpTransform3D was not usable in the ResampleImageFilter since it has no parameters, but is controlled by the DeformationField ivar. The class was modified to provide a CreateAnother method.
 +
 +
==Analyze ==
 +
Here we rationalize the ITK4 API changes.
 +
* Remove OStringStream
 +
:Early in the development of ITK, some compilers did not support stringstream. There was a wrapper to hide differences between std::stringstream and the old ostrstream(which has been deprecated).
 +
* Remove New method for Rigid3DTransform
 +
: Rigid3DTransform was meant to be a base class for 3D rigid registration. Unfortunately, in prior versions of ITK, it had a New() method. Since it has 12 optimization parameters, its use in registration is unstable. The preferred rigid registration is Versor3DRigidRegistration. In ITK4 we decided to enforce the intent of the original class (as an abstract base class). Since Slicer/3/4 was using it as a non-virtual class, we added two backward compatible solutions:
 +
:# If the ITK cmake variable ITKV3_COMPATIBILITY flag is ON, itk::Rigid3DTransform behaves exactly as it did in ITK3.x.
 +
:# When Slicer4 transitions to ITK4 and uses new ITK4 capabilities, the old behavior of itk::Rigid3DTransform is available in itkv3::Rigid3DTransform.
 +
:# http://review.source.kitware.com/#change,680
 +
* New Transform pure virtual methods
 +
: In ITK3, itk::Transform provided dummy implementations for some methods that should be implemented by derived classes. These dummy methods printed a warning "This method should be implemented in subclasses".In ITK4, to make developers aware that they should implement these methods for derived subclasses, these methods are pure virtual. This means that subclasses that do not provide an implementation for these methods will no longer compile. Slicer's  ''Applications/CLI/DiffusionApplications/ResampleDTI/itkWarpTransform3D'' did not implement ''SetParameters()'',''SetFixedParameters()'', ''TransformVector()'' and ''TransformCovariantVector()''. The Slicer4 code now provides these methods and throws an exception if they are used.
 +
* Remove Brains2MaskImageIO
 +
* Upgrade GDCM to v2
 +
 +
==References==
 +
* [http://itk.org/Wiki/ITK_Release_4.0 The ITKv4 Wiki Page]
 +
* [http://itk.org/Wiki/ITK_Release_4/What_Developers_Must_Do_To_Contribute_to_the_Users_Migration_Guide ITKv4 Migration Guide]

Latest revision as of 13:39, 10 July 2017

Home < 2011 Winter Project Week: Slicer4-ITK4 Continuous Integration

Key Investigators

  • Bill Lorensen - Noware
  • Luis - Kitware
  • Mark Scully (Kent Williams/Hans Johnson) - Iowa

Objective

Identify API changes in ITK4 that cause compilation or run-time errors in Slicer4. NA-MIC is a major customer of the insight Toolkit, ITK. It is critical that ITK developers understand the impact of API changes on customers. As part of the ITKv4 contract Slicer3 will be one of the sequestered applications. This project goes beyond that and will continuously integrate Slicer4 and ITK4.

Slicer4 development is under-way and ITK version 4 has recently started. One of the goals of ITK 4 is to improve, simplify and clean-up the application programming interface (API). Every attempt is being made to keep the API compatible with ITK 3.x.

The API changes may be planned or accidental. This project will establish mechanisms to discover, resolve and document API issues that affect Slicer4. We expect that a similar process will be created for other major ITK customers.

Approach, Plan

This project will use the DMAIC methodology of the Six Sigma management process to "Define", "Measure", "Analyze", "Improve" and "Control" the integration of Slicer4 and ITK4.

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

  • Define process goals that are consistent with customer demands and the NA-MIC'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.

Progress


Measure - ITK4 Changes that Affect Slicer4

Here we summarize the API change that caused Slicer4 to not compile or run incorrectly. For each API change we list the major classes affected, how the issue was resolved and whether the change is compatible with ITK3.x. We also include a pointer to the Migration Guide section that deals with the issue.

API Change Classes Affected Resolution Works for ITK3 ITK Migration Doc

Remove OStringStream

Many

Replace OStringStream with std::stringstream

Yes

Nothing yet

Remove New method for Rigid3DTransform

vtkSlicerTransformLogic ResampleVolume2.cxx

Introduced ITKv3_COMPATIBILITY cmake variable that when ON, permits a New() on Rigid3DTransform. This mimics the old behaviour.

NA

Nothing yet

New Transform pure virtual methods

itkWarpTransform3D.h

Added itkExceptionMacro to each pure virtual method that was not implemented.

Yes

Nothing yet

Remove Brains2MaskImageIO

BRAINSTools

Skip building for ITKv4. Mark Scully is nearly done with necessary refactorings.

Yes

Task assigned to Kent Williams

Upgrade GDCM to v2

DicomToNrrdConverter

Skip building for ITKv4. This will be upgraded to gdcm2. See other project week item: [[1]]

NA

Not Yet

Measure - Test Failures

  • DiffusionTensorEstimationTest floating point overflow
    • Nrrd floating point exception (expected)
  • DiffusionTensorMathematicsTest floating point overflow
    • Nrrd floating point exception (expected)
  • N4ITKBiasFieldCorrectionTest floating point zero divide
    • Fixed by Andri Fedorov. Slicer 3 upgraded to itkv4 version.
    • Needed new baseline
  • PolyDataToLabelmapTest small image error
    • --compareNumberOfPixelsTolerance 20
  • RegisterImagesMultiResTest abort
    • Problems in regression testing.
  • ResampleDTI2RigidTransformsLinearTest small image error
    • 1 pixel difference. Added --compareIntensityTolerance 1.
  • ResampleDTIBSplineWSInterpolationTest small image error
    • 1 pixel difference. Added --compareIntensityTolerance 1.
  • ResampleVolume2BSplineWSInterpolationTest SetParameters exception
    • Fixed by Francois Budin
  • ResampleVolume2HFieldTest SetParameters exception
    • Fixed by Francois Budin
  • ResampleVolume2RotationNNTest segmentation violation
    • The WarpTransform3D was not usable in the ResampleImageFilter since it has no parameters, but is controlled by the DeformationField ivar. The class was modified to provide a CreateAnother method.

Analyze

Here we rationalize the ITK4 API changes.

  • Remove OStringStream
Early in the development of ITK, some compilers did not support stringstream. There was a wrapper to hide differences between std::stringstream and the old ostrstream(which has been deprecated).
  • Remove New method for Rigid3DTransform
Rigid3DTransform was meant to be a base class for 3D rigid registration. Unfortunately, in prior versions of ITK, it had a New() method. Since it has 12 optimization parameters, its use in registration is unstable. The preferred rigid registration is Versor3DRigidRegistration. In ITK4 we decided to enforce the intent of the original class (as an abstract base class). Since Slicer/3/4 was using it as a non-virtual class, we added two backward compatible solutions:
  1. If the ITK cmake variable ITKV3_COMPATIBILITY flag is ON, itk::Rigid3DTransform behaves exactly as it did in ITK3.x.
  2. When Slicer4 transitions to ITK4 and uses new ITK4 capabilities, the old behavior of itk::Rigid3DTransform is available in itkv3::Rigid3DTransform.
  3. http://review.source.kitware.com/#change,680
  • New Transform pure virtual methods
In ITK3, itk::Transform provided dummy implementations for some methods that should be implemented by derived classes. These dummy methods printed a warning "This method should be implemented in subclasses".In ITK4, to make developers aware that they should implement these methods for derived subclasses, these methods are pure virtual. This means that subclasses that do not provide an implementation for these methods will no longer compile. Slicer's Applications/CLI/DiffusionApplications/ResampleDTI/itkWarpTransform3D did not implement SetParameters(),SetFixedParameters(), TransformVector() and TransformCovariantVector(). The Slicer4 code now provides these methods and throws an exception if they are used.
  • Remove Brains2MaskImageIO
  • Upgrade GDCM to v2

References