Skip to content

Commit

Permalink
rewrite setpix funcs to procinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
oguyon committed Sep 16, 2023
1 parent a1b58a2 commit e0e8062
Show file tree
Hide file tree
Showing 18 changed files with 1,095 additions and 525 deletions.
65 changes: 40 additions & 25 deletions plugins/milk-extra-src/image_filter/gaussfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,13 @@ typedef struct
int *CBsize;
} LOCVAR_INIMG2D;

// Local variables pointers
//static LOCVAR_INIMG2D inim;
//static LOCVAR_OUTIMG2D outim;
//static float *sigmaval;
//static int *filtsizeval;

// ==========================================
// Forward declaration(s)
// ==========================================

imageID gauss_filter(const char *__restrict ID_name,
const char *__restrict out_name,
float sigma,
int filter_size);

// ==========================================
// Command line interface wrapper function(s)
// ==========================================

static errno_t gauss_filter_cli()
{
Expand All @@ -56,9 +45,7 @@ static errno_t gauss_filter_cli()
}
}

// ==========================================
// Register CLI command(s)
// ==========================================


errno_t gaussfilter_addCLIcmd()
{
Expand All @@ -75,10 +62,16 @@ errno_t gaussfilter_addCLIcmd()
return RETURN_SUCCESS;
}

imageID gauss_filter(const char *__restrict ID_name,
const char *__restrict out_name,
float sigma,
int filter_size)




imageID gauss_filter(
const char *__restrict ID_name,
const char *__restrict out_name,
float sigma,
int filter_size
)
{
imageID ID;
imageID IDout;
Expand Down Expand Up @@ -125,7 +118,14 @@ imageID gauss_filter(const char *__restrict ID_name,
naxes[2] = 1;
}
copy_image_ID(ID_name, out_name, 0);
arith_image_zero(out_name);

{
IMGID outimg = mkIMGID_from_name(out_name);
resolveIMGID(&outimg, ERRMODE_ABORT);
image_setzero(outimg);
}


create_2Dimage_ID("gtmp", naxes[0], naxes[1], &IDtmp);
// copy_image_ID(ID_name,"gtmp", 0);
// arith_image_zero("gtmp");
Expand Down Expand Up @@ -274,10 +274,14 @@ imageID gauss_filter(const char *__restrict ID_name,
return IDout;
}

imageID gauss_3Dfilter(const char *__restrict ID_name,
const char *__restrict out_name,
float sigma,
int filter_size)


imageID gauss_3Dfilter(
const char *__restrict ID_name,
const char *__restrict out_name,
float sigma,
int filter_size
)
{
imageID ID;
imageID IDout;
Expand All @@ -302,9 +306,20 @@ imageID gauss_3Dfilter(const char *__restrict ID_name,
naxes[2] = data.image[ID].md[0].size[2];

copy_image_ID(ID_name, out_name, 0);
arith_image_zero(out_name);
{
IMGID outimg = mkIMGID_from_name(out_name);
resolveIMGID(&outimg, ERRMODE_ABORT);
image_setzero(outimg);
}

copy_image_ID(ID_name, "gtmp", 0);
arith_image_zero("gtmp");

{
IMGID imggtmp = mkIMGID_from_name("gtmp");
resolveIMGID(&imggtmp, ERRMODE_ABORT);
image_setzero(imggtmp);
}

copy_image_ID("gtmp", "gtmp1", 0);
IDtmp = image_ID("gtmp");
IDtmp1 = image_ID("gtmp1");
Expand Down
16 changes: 12 additions & 4 deletions src/COREMOD_arith/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ message(" SRCNAME = ${SRCNAME} -> LIBNAME = ${LIBNAME}")

set(SOURCEFILES
${SRCNAME}.c
set_pixel.c
image_crop.c
image_cropmask.c
image_merge3D.c
image_total.c
image_set_1Dpixrange.c
image_set_2Dpix.c
image_set_col.c
image_set_row.c
image_setzero.c
image_stats.c
image_total.c
image_dxdy.c
imfunctions.c
mathfuncs.c
Expand All @@ -26,12 +30,16 @@ set(SOURCEFILES

set(INCLUDEFILES
${SRCNAME}.h
set_pixel.h
image_crop.h
image_cropmask.h
image_merge3D.h
image_total.h
image_set_1Dpixrange.h
image_set_2Dpix.h
image_set_col.h
image_set_row.h
image_setzero.h
image_stats.h
image_total.h
image_dxdy.h
imfunctions.h
mathfuncs.h
Expand Down
16 changes: 12 additions & 4 deletions src/COREMOD_arith/COREMOD_arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,15 @@
#include "image_dxdy.h"
#include "image_merge3D.h"
#include "image_stats.h"

#include "image_set_1Dpixrange.h"
#include "image_set_2Dpix.h"
#include "image_set_col.h"
#include "image_set_row.h"
#include "image_setzero.h"

#include "image_total.h"
#include "imfunctions.h"
#include "set_pixel.h"

#include "image_arith__im__im.h"
#include "image_arith__im_f__im.h"
Expand All @@ -82,15 +88,17 @@ static errno_t init_module_CLI()

image_crop_addCLIcmd();

set_pixel_addCLIcmd();

image_arith__im_f_f__im_addCLIcmd();

CLIADDCMD_COREMOD_arith__image_merge();

CLIADDCMD_COREMODE_arith__cropmask();

// add atexit functions here
CLIADDCMD_COREMOD_arith__imset_1Dpixrange();
CLIADDCMD_COREMOD_arith__imset_2Dpix();
CLIADDCMD_COREMOD_arith__imset_col();
CLIADDCMD_COREMOD_arith__imset_row();
CLIADDCMD_COREMOD_arith__imsetzero();

return RETURN_SUCCESS;
}
Expand Down
8 changes: 7 additions & 1 deletion src/COREMOD_arith/COREMOD_arith.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
#include "COREMOD_arith/image_stats.h"
#include "COREMOD_arith/image_total.h"
#include "COREMOD_arith/imfunctions.h"
#include "COREMOD_arith/set_pixel.h"

#include "COREMOD_arith/image_setzero.h"
#include "COREMOD_arith/image_set_col.h"
#include "COREMOD_arith/image_set_row.h"
#include "COREMOD_arith/image_set_1Dpixrange.h"
#include "COREMOD_arith/image_set_2Dpix.h"


//imageID arith_make_slopexy(const char *ID_name, long l1,long l2, double sx, double sy);

Expand Down
2 changes: 1 addition & 1 deletion src/COREMOD_arith/execute_arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "image_stats.h"
#include "image_total.h"
#include "imfunctions.h"
#include "set_pixel.h"


#define ARITHTOKENTYPE_UNKNOWN 0
#define ARITHTOKENTYPE_NOTEXIST 1 // non-existing variable or image
Expand Down
Loading

0 comments on commit e0e8062

Please sign in to comment.