MantisBT - ITK
View Issue Details
0008680ITKpublic2009-03-06 09:352010-10-21 12:32
Bryn Lloyd 
kentwilliams 
normalmajoralways
closedfixed 
ITK-3-12 
 
0008680: Output Spacing etc. is not set in ReinitializeLevelSetImageFilter
The output information (spacing, origin, etc.) is not set in the ReinitializeLevelSetImageFilter.

The reason why I believe this is the case is that when I pass an image with spacings [0.1, 0.1, 0.5]mm I get distance value around 1.0mm, while corresponding distance values (from a distance map) are approx. 0.1mm.


The code in ReinitializeLevelSetImageFilter.txx uses the FastmarchingFilter internally. It is necessary to set the output information in the FastmarchingFilter.

However, it does NOT set the OutputSpacing and Origin of the FastMarching object, i.e. this must be BUG.
This code should fix the problem:

void
ReinitializeLevelSetImageFilter<TLevelSet>
::GenerateData()
{
  this->AllocateOutput();
//****** NEW ******
  this->m_Marcher->SetOutputOrigin(this->GetInput()->GetOrigin());
  this->m_Marcher->SetOutputDirection(this->GetInput()->GetDirection());
  this->m_Marcher->SetOutputSpacing(this->GetInput()->GetSpacing());

//****** NEW ******
  if( m_NarrowBanding )
    {
    this->GenerateDataNarrowBand();
    }
  else
    {
    this->GenerateDataFull();
    }
}

No tags attached.
related to 0008058closed kentwilliams Output Image directions are not set consistently from filters 
cxx ReinitializeLevelSetImageFilter.cxx (3,920) 2009-03-06 09:41
https://public.kitware.com/Bug/file/2105/ReinitializeLevelSetImageFilter.cxx
Issue History
2009-03-06 09:35Bryn LloydNew Issue
2009-03-06 09:41Bryn LloydFile Added: ReinitializeLevelSetImageFilter.cxx
2009-03-26 17:29kentwilliamsRelationship addedrelated to 0008058
2009-03-26 17:29kentwilliamsStatusnew => assigned
2009-03-26 17:29kentwilliamsAssigned To => kentwilliams
2009-03-26 17:43kentwilliamsNote Added: 0015807
2009-03-27 03:52Bryn LloydNote Added: 0015810
2009-03-31 15:42kentwilliamsNote Added: 0015876
2009-03-31 15:42kentwilliamsStatusassigned => resolved
2009-03-31 15:42kentwilliamsResolutionopen => fixed
2010-10-21 12:32Gabe HartStatusresolved => closed

Notes
(0015807)
kentwilliams   
2009-03-26 17:43   
I am looking at your suggested fix. I moved the suggested additions up into AllocateOutput, where the MarchingCubes instance already has its output size set.

You could help me out by suggesting a possible regression test of this bug -- i.e. something that fails now that would succeed if this was fixed. I'm looking in itkReinitializeLevelSetImageFilterTest.cxx (in Insight/Testing/Code/Algorithms) and it looks like the test leave the spacing and dir cosines at their default values, i.e. 1,1,1 and identity.

Would it be sufficient to replicate this test, but assign non-default directions and spacing? Or do you have a succinct test in mind.
(0015810)
Bryn Lloyd   
2009-03-27 03:52   
I would suggest following (very simple) test, in order to verify that the spacing is used:

Run the ReinitializeLevelSetImageFilter with an in image with spacing (1,1,1) and then run another instance with the "same" image, but now with a modified spacing of (0.1,0.1,0.1).

Test if the result is scaled by 0.1 in the second instance.


At the same time the image origin could also be changed and checked.
(0015876)
kentwilliams   
2009-03-31 15:42   
I added the suggested code to the filter.