Skip to content
Snippets Groups Projects
Commit 67bf0018 authored by Vesa Oikonen's avatar Vesa Oikonen
Browse files

added option -noneg

parent 5b95b7a9
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,8 @@ static char *info[] = {
" default is 0%.",
// " Pixels with AUC less than (threshold/100 x max AUC) are set to zero.",
// " Default is 0 %.",
" -noneg",
" Pixels with negative Ki are set to zero.",
" -max=<Max value>",
" Upper limit for Ki values.",
" -filter",
......@@ -131,6 +133,7 @@ int main(int argc, char **argv)
int ai, help=0, version=0, verbose=1;
int fi, ret;
int param_filt=0;
int noneg=0; // 0=negative values are kept, 1=negative values set to zero
char inpfile[FILENAME_MAX], petfile[FILENAME_MAX];
char icfile[FILENAME_MAX], nrfile[FILENAME_MAX], outfile[FILENAME_MAX];
char tmp[1024], *cptr;
......@@ -166,6 +169,8 @@ int main(int argc, char **argv)
density=atof_dpi(cptr+2); if(density>0.0) continue;
} else if(strncasecmp(cptr, "DENSITY=", 8)==0) {
density=atof_dpi(cptr+8); if(density>0.0) continue;
} else if(strncasecmp(cptr, "NONEGATIVES", 5)==0) {
noneg=1; continue;
} else if(strncasecmp(cptr, "MAX=", 4)==0) {
upperLimit=atof_dpi(cptr+4); if(upperLimit>0.0) continue;
} else if(strncasecmp(cptr, "E=", 2)==0) {
......@@ -233,6 +238,7 @@ int main(int argc, char **argv)
printf("density := %g\n", density);
printf("param_filt := %d\n", param_filt);
printf("calcThreshold := %g%%\n", 100.*calcThreshold);
printf("noneg := %d\n", noneg);
fflush(stdout);
}
if(verbose>9) IMG_TEST=verbose-9; else IMG_TEST=0;
......@@ -328,6 +334,11 @@ int main(int argc, char **argv)
if(verbose>0) fprintf(stdout, "filtering out Ki values exceeding %g\n", upperLimit);
imgCutoff(&out, (float)upperLimit, 0);
}
/* Remove negative Ki values, if requested */
if(noneg) {
if(verbose>0) fprintf(stdout, "filtering out negative Ki values\n");
imgCutoff(&out, 0.0, 1);
}
/*
* Filter out pixels that are over 4x higher than their
* closest neighbours
......
#!/bin/bash
#: Title : test_imgki
#: Date : 2019-06-26
#: Date : 2019-09-18
#: Author : "Vesa Oikonen" <vesa.oikonen@utu.fi>
#: Options : None
......@@ -298,7 +298,7 @@ printf "===================================================================\n"
printf "\n 2.0.0 \n"
printf " Test case: Dynamic ECAT7 image, starting fit from 30 min. \n"
printf " Test case 1: Dynamic ECAT7 image, starting fit from 30 min. \n"
printf " Expected result: Correct result. \n\n"
rm -f output.v output.dft output.res stdout.txt
......@@ -321,9 +321,9 @@ printf "\n ok \n"
dft2res output.dft
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
resmatch -res=1 -abs=0.0005 patlak.res output.res
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
resmatch -res=1 -abs=0.0005 patlak.res output.res
printf "\n comparing computed ki image to correct ki image \n\n"
imgmatch -frames=n -abs=0.005 -rel=10 correct_ki.v output.v
......@@ -426,6 +426,37 @@ if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n-----------------------------------------------------------------\n\n"
printf "\n 2.3.0 \n"
printf " Test case 1: Dynamic ECAT7 image, starting fit from 30 min. \n"
printf " Test case 2: Option -noneg sets negative values to zero. \n"
printf " Expected result: Correct result. \n\n"
rm -f output.v output.dft output.res stdout.txt
$PROGRAM -noneg plasma.dat dynamic.v 30 output.v
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
img2dft -P output.v plane1.roi output.dft
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
dftmax -min -x=y -y=y output.dft > stdout.txt
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n ok \n"
iftisval stdout.txt "overall_min_value" 0
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n comparing computed ki image to correct ki image \n\n"
imgmatch -frames=n -abs=0.005 -rel=10 correct_ki.v output.v
if [ $? -ne 0 ] ; then printf "Failed!\n" ; exit 1 ; fi
printf "\n passed. \n\n"
printf "\n===================================================================\n"
printf " Other image formats \n"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment