[Insight-users] LaplacianImageFilter only works on float or double images?

Luis Ibanez luis.ibanez at kitware.com
Sat Dec 4 20:08:50 EST 2010


Hi David,


You may have found a bug in the LaplacianImageFilter.


Please try the following patch:


diff --git a/Code/BasicFilters/itkLaplacianImageFilter.h
b/Code/BasicFilters/itkLaplacianImageFilter.h
index 7b36e7f..e1aded9 100644
--- a/Code/BasicFilters/itkLaplacianImageFilter.h
+++ b/Code/BasicFilters/itkLaplacianImageFilter.h
@@ -119,10 +119,6 @@ public:
   /** Begin concept checking */
   itkConceptMacro( SameDimensionCheck,
                    ( Concept::SameDimension< InputImageDimension,
ImageDimension > ) );
-  itkConceptMacro( InputPixelTypeIsFloatingPointCheck,
-                   ( Concept::IsFloatingPoint< InputPixelType > ) );
-  itkConceptMacro( OutputPixelTypeIsFloatingPointCheck,
-                   ( Concept::IsFloatingPoint< OutputPixelType > ) );
   /** End concept checking */
 #endif
 protected:
diff --git a/Code/BasicFilters/itkLaplacianImageFilter.txx
b/Code/BasicFilters/itkLaplacianImageFilter.txx
index 8649b47..aa175bf 100644
--- a/Code/BasicFilters/itkLaplacianImageFilter.txx
+++ b/Code/BasicFilters/itkLaplacianImageFilter.txx
@@ -99,7 +99,7 @@ LaplacianImageFilter< TInputImage, TOutputImage >
   output->SetBufferedRegion( output->GetRequestedRegion() );
   output->Allocate();

-  ZeroFluxNeumannBoundaryCondition< TOutputImage > nbc;
+  ZeroFluxNeumannBoundaryCondition< TInputImage > nbc;

   // Create the Laplacian operator
   LaplacianOperator< OutputPixelType, ImageDimension > oper;

--------------------


In summary,
the boundary condition should have been declared in
terms of the input image type,
not in terms of the output image type.


     Luis


---------------------------------------------
On Fri, Dec 3, 2010 at 3:18 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
> It could possibly add a lot more memory and surprise the user. The
> user can decide to how handle this. Perhaps, reading the data into
> float.
>
> On Fri, Dec 3, 2010 at 3:05 PM, David Doria <daviddoria at gmail.com> wrote:
>> On Fri, Dec 3, 2010 at 3:02 PM, robert tamburo <robert.tamburo at gmail.com> wrote:
>>> If you're interested in a workaround, you can use CastImageFilter to cast to
>>> an image of floating point pixels.
>>
>> Thanks Robert. What you mentioned definitely works. I am more
>> interested in why this isn't done automatically inside the filter so
>> the user doesn't have to do it.
>>
>> David
>> _____________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://www.kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-users
>>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>


More information about the Insight-users mailing list