]> Creatis software - creaRigidRegistration.git/commitdiff
*** empty log message ***
authortrillos <trillos>
Thu, 15 Oct 2009 11:28:07 +0000 (11:28 +0000)
committertrillos <trillos>
Thu, 15 Oct 2009 11:28:07 +0000 (11:28 +0000)
lib/Convolution.cxx
lib/Convolution.h

index ac83f16fe0299c21b364fba4e391fd938aad217d..450df87222c0ba01bee5c9aa32de2ebf01febef6 100644 (file)
@@ -37,12 +37,26 @@ void Convolution::setFactor(double factor)
        _factor = (factor/100.0)*5.0;   
 }
 
-void Convolution::Run()
+void Convolution::setOn(bool on)
 {
-       double kernel[] = {0.0,1.0,0.0,1.0,-_factor,1.0,0.0,1.0,0.0};
-       _convolve->SetKernel3x3(kernel);
-       _convolve->Update();
-       _cast->SetInput(_convolve->GetOutput());
-       _cast->SetOutputScalarTypeToDouble();
+       _on = on;
 }
 
+void Convolution::Run()
+{
+       if(_on)
+       {
+               double kernel[] = {0.0,1.0,0.0,1.0,-_factor,1.0,0.0,1.0,0.0};
+               _convolve->SetKernel3x3(kernel);
+               _convolve->Update();
+               _cast->SetInput(_convolve->GetOutput());
+               _cast->SetOutputScalarTypeToDouble();
+               _cast->Update();
+       }
+       else
+       {
+               _cast->SetInput(_image);
+               _cast->SetOutputScalarType(_image->GetScalarType());
+               _cast->Update();
+       }       
+}
\ No newline at end of file
index 5de8819ca6ddef29cb51df2e4fb5f2b56061fcc9..3be90f828cf89ef10b4d452569c2b73bf3d0639c 100644 (file)
@@ -17,6 +17,7 @@ class Convolution
                
                void setImage(vtkImageData *image);
                void setFactor(double factor);
+               void setOn(bool on);
 
                void Run();
                
@@ -34,5 +35,6 @@ class Convolution
 
                //Casting Filter
                vtkImageCast *_cast;
-};
 
+               bool _on;
+};
\ No newline at end of file