Skip to content

Commit

Permalink
Merge pull request #554 from tsadakane/fix_matlab-im3ddenoise-datatyp…
Browse files Browse the repository at this point in the history
…e-check

Add data type check for tvDenoise to im3DDenoise
  • Loading branch information
AnderBiguri authored Jun 1, 2024
2 parents 2b18d9b + 570dd7e commit 440c8c6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion MATLAB/Utilities/im3DDenoise.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function [ imgO ] = im3DDenoise( img,type,varargin )
%IMDENOISE3D removes noise of image with different methods
% Currentyl only TV is supported. INput arguments are the iamge, the type
% Currentyl only TV is supported. Input arguments are the image, the type
% of denoising ('TV' only now) and the parameters for the denoising,
% being number of iterations and hyperparameter currently available.
%--------------------------------------------------------------------------
Expand Down Expand Up @@ -39,6 +39,11 @@
immax=max(img(:));

img=img./(immax+2*eps);

% Generates an error if the data type of img is not single-precision float
if ~isa(img, 'single')
error('im3DDenoise: Input image of tvDenoise must be single precision');
end
if ndims(img)==2
imgO=tvDenoise(cat(3,img,img),hyper,iter,gpuids.devices);
imgO=imgO(:,:,1);
Expand Down

0 comments on commit 440c8c6

Please sign in to comment.