Skip to content

Commit

Permalink
Merge pull request #1543 from ANTsX/SharpenWithoutSpacing
Browse files Browse the repository at this point in the history
ENH:  Add spacing option for laplacian sharpening.
  • Loading branch information
ntustison authored Jul 4, 2023
2 parents a95dae6 + 8af352d commit d62539d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Examples/ImageMath.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ ImageMath(std::vector<std::string> args, std::ostream * itkNotUsed(out_stream))
std::cout << " Usage : SigmoidImage ImageIn [alpha=1.0] [beta=0.0]" << std::endl;

std::cout << "\n Sharpen : Apply a Laplacian sharpening filter" << std::endl;
std::cout << " Usage : Sharpen ImageIn" << std::endl;
std::cout << " Usage : Sharpen ImageIn [useImageSpacing=(1)/0]" << std::endl;

std::cout << "\n UnsharpMask Apply an Unsharp Mask filter" << std::endl;
std::cout
Expand Down
7 changes: 7 additions & 0 deletions Examples/ImageMath_Templates.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -2164,12 +2164,19 @@ SharpenImage(int argc, char * argv[])
const std::string outputFilename = std::string(argv[2]);
const std::string inputFilename = std::string(argv[4]);

bool useImageSpacing = true;
if(argc > 5)
{
useImageSpacing = static_cast<bool>(std::stoi(argv[5]));
}

typename ImageType::Pointer inputImage = nullptr;
ReadImage<ImageType>(inputImage, inputFilename.c_str());

typedef itk::LaplacianSharpeningImageFilter<ImageType, ImageType> FilterType;
typename FilterType::Pointer filter = FilterType::New();
filter->SetInput(inputImage);
filter->SetUseImageSpacing(useImageSpacing);
filter->Update();

ANTs::WriteImage<ImageType>(filter->GetOutput(), outputFilename.c_str());
Expand Down
1 change: 0 additions & 1 deletion Examples/antsVol.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSampleFunction.h"
#include "vtkSmartPointer.h"
#include "vtkSmartVolumeMapper.h"
#include "vtkSphere.h"
Expand Down
2 changes: 1 addition & 1 deletion Scripts/antsMultivariateTemplateConstruction.sh
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function summarizeimageset() {
;;
1)
echo "Laplacian sharpening"
${ANTSPATH}/ImageMath $dim $output Sharpen $output
${ANTSPATH}/ImageMath $dim $output Sharpen $output 0
;;
2)
echo "Unsharp mask sharpening"
Expand Down
2 changes: 1 addition & 1 deletion Scripts/antsMultivariateTemplateConstruction2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ function summarizeimageset() {
;;
1)
echo "Laplacian sharpening"
${ANTSPATH}/ImageMath $dim $output Sharpen $output
${ANTSPATH}/ImageMath $dim $output Sharpen $output 0
;;
2)
echo "Unsharp mask sharpening"
Expand Down

0 comments on commit d62539d

Please sign in to comment.