Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add spacing option for laplacian sharpening. #1543

Merged
merged 3 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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