From 570dd7ed366238e8589a0be0ffa432d641339293 Mon Sep 17 00:00:00 2001 From: Tomoyuki SADAKANE <40597344+tsadakane@users.noreply.github.com> Date: Sat, 1 Jun 2024 10:03:16 +0900 Subject: [PATCH] Add data type check for tvDenoise to im3DDenoise * See #533 --- MATLAB/Utilities/im3DDenoise.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/MATLAB/Utilities/im3DDenoise.m b/MATLAB/Utilities/im3DDenoise.m index 8e403c92..c678c644 100644 --- a/MATLAB/Utilities/im3DDenoise.m +++ b/MATLAB/Utilities/im3DDenoise.m @@ -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. %-------------------------------------------------------------------------- @@ -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);