View Issue Details

IDProjectCategoryView StatusLast Update
0003916Slicer4Module BRAINSpublic2015-11-30 17:39
Reporterdzenanz Assigned Tohjmjohnson  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionSlicer 4.4.0 
Target VersionFixed in VersionSlicer 4.5.0-1 
Summary0003916: BRAINSFit: splineGridSize vector vs scalar behaves differently on Windows and Linux
Description

When BRAINSFit module is invoked with BSpline registration, and scalar value is supplied as splineGridSize parameter (--splineGridSize 5) instead of vector (--splineGridSize 5,5,5), BRAINSFit crashes on Windows whereas it completes without error on Linux.

Behavior should be the same on both OSes, preferably not crashing.

Additional Information

Checked on Ubuntu 14.04 and Windows 7, both 64 bit.

TagsNo tags attached.

Activities

lassoan

lassoan

2014-12-21 18:05

developer   ~0012798

This is caused by a bug in BrainsFit in BRAINSTools\BRAINSCommonLib\BRAINSFitHelperTemplate.hxx. If the splineGridSize parameter vector has less than 3 components then an invalid memory access occurs here (SpaceDimension==3; m_SplineGridSize.size()==1):

  // Initialize the BSpline transform
  // Using BSplineTransformInitializer
  //
  BSplineTransformType::MeshSizeType    meshSize;
  for( unsigned int i=0; i< SpaceDimension; i++ )
    {
    meshSize[i] = m_SplineGridSize[i];
    }

This should crash on all platforms. It is surprising why it does not crash on Linux.

It is easy to fix the problem by adding checks and/or use the same parameters for all dimension if only one parameter is specified, but the fix has to be done in BRAINS.

lassoan

lassoan

2014-12-21 18:10

developer   ~0012799

Reported the problem at the BRAINS bugtracker:
https://github.com/BRAINSia/BRAINSTools/issues/166

dzenanz

dzenanz

2014-12-21 18:14

developer   ~0012800

I thought this was the bug tracker for BRIANS tools :)

lassoan

lassoan

2014-12-21 18:15

developer   ~0012801

Example command-line options to reproduce the problem:

C:/Program Files/Slicer 4.4.0/lib/Slicer-4.4/cli-modules/BRAINSFit.exe --fixedVolume C:/Users/Andras/AppData/Local/Temp/Slicer/HEEI_vtkMRMLScalarVolumeNodeC.nrrd --movingVolume C:/Users/Andras/AppData/Local/Temp/Slicer/HEEI_vtkMRMLScalarVolumeNodeE.nrrd --bsplineTransform C:/Users/Andras/AppData/Local/Temp/Slicer/HEEI_vtkMRMLBSplineTransformNodeB.h5 --initializeTransformMode Off --samplingPercentage 0.002 --useBSpline --splineGridSize 6 --numberOfIterations 1500 --maskProcessingMode NOMASK --outputVolumePixelType float --backgroundFillValue 0 --maskInferiorCutOffFromCenter 1000 --interpolationMode Linear --minimumStepLength 0.001 --translationScale 1000 --reproportionScale 1 --skewScale 1 --maxBSplineDisplacement 0 --numberOfHistogramBins 50 --numberOfMatchPoints 10 --numberOfSamples 0 --fixedVolumeTimeIndex 0 --movingVolumeTimeIndex 0 --medianFilterSize 0,0,0 --removeIntensityOutliers 0 --useCachingOfBSplineWeightsMode ON --useExplicitPDFDerivativesMode AUTO --ROIAutoDilateSize 0 --ROIAutoClosingSize 9 --relaxationFactor 0.5 --maximumStepLength 0.05 --failureExitCode -1 --numberOfThreads -1 --forceMINumberOfThreads -1 --debugLevel 0 --costFunctionConvergenceFactor 2e+013 --projectedGradientTolerance 1e-005 --maximumNumberOfEvaluations 900 --maximumNumberOfCorrections 25 --metricSamplingStrategy Random --costMetric MMI --metricSeed 21474836

Changing this one parameter the registration completes successfully:
--splineGridSize 6,6,6

hjmjohnson

hjmjohnson

2014-12-22 04:38

developer   ~0012802

lassoan,

Thank you for tracking this down. We are making several other changes to BRAINSTools and will work over the holiday season to upgrade Slicer.

Hans

lassoan

lassoan

2014-12-22 08:48

developer   ~0012803

Great, thank you!

hjmjohnson

hjmjohnson

2015-01-09 07:10

developer   ~0012871

This version of BRAINSTools was updated during NAMIC Winter project week 2015.

commit 38c2198c44c8f2dbd405654c2465f2991a637999
Merge: 19fa37d cce8056
Author: Ali Ghayoor <ali-ghayoor@uiowa.edu>
Date: Tue Dec 23 10:56:24 2014 -0600

Merge pull request 0000167 from aghayoor/BFitBSplineGridSize

BUG: Fix BFit crash when only one value is set for splineGridSize

Issue History

Date Modified Username Field Change
2014-12-10 11:49 dzenanz New Issue
2014-12-10 11:49 dzenanz Status new => assigned
2014-12-10 11:49 dzenanz Assigned To => hjmjohnson
2014-12-21 18:05 lassoan Note Added: 0012798
2014-12-21 18:10 lassoan Note Added: 0012799
2014-12-21 18:14 dzenanz Note Added: 0012800
2014-12-21 18:15 lassoan Note Added: 0012801
2014-12-22 04:38 hjmjohnson Note Added: 0012802
2014-12-22 08:48 lassoan Note Added: 0012803
2015-01-09 07:10 hjmjohnson Note Added: 0012871
2015-01-09 07:10 hjmjohnson Status assigned => resolved
2015-01-09 07:10 hjmjohnson Fixed in Version => Slicer 4.4.1
2015-01-09 07:10 hjmjohnson Resolution open => fixed
2015-01-09 07:10 hjmjohnson Status resolved => closed
2015-09-09 08:29 jcfr Fixed in Version Slicer 4.4.1 => Slicer 4.5.0-1
2015-11-30 17:39 jcfr Summary splineGridSize vector vs scalar behaves differently on Windows and Linux => BRAINSFit: splineGridSize vector vs scalar behaves differently on Windows and Linux