preparing DICOM entry
This commit is contained in:
@@ -10,6 +10,34 @@
|
||||
|
||||
#include "../floatimg.h"
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
int fimg_show_filter(char *title, FimgFilter3x3 *filtr)
|
||||
{
|
||||
float *M; /* alias of filter matrix */
|
||||
int foo, idx;
|
||||
float sum, value;
|
||||
|
||||
if (title) fprintf(stderr, "--------- %s ---------\n", title);
|
||||
|
||||
M = filtr->matrix; /* aliasing here */
|
||||
|
||||
fprintf(stderr, "%8.3f %8.3f %8.3f\n", M[0], M[1], M[2]);
|
||||
fprintf(stderr, "%8.3f %8.3f %8.3f\n", M[3], M[4], M[5]);
|
||||
fprintf(stderr, "%8.3f %8.3f %8.3f\n", M[6], M[7], M[8]);
|
||||
|
||||
sum = 0.0;
|
||||
for (idx=0; idx<9; idx++) sum += M[idx];
|
||||
fprintf(stderr, " sum %8.3f\n", sum);
|
||||
fprintf(stderr, " mult %8.3f\n", filtr->mult);
|
||||
fprintf(stderr, " offset %8.3f\n", filtr->offset);
|
||||
|
||||
value = (sum * filtr->mult) + filtr->offset;
|
||||
fprintf(stderr, " value %8.3f ???\n", sum);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------------- */
|
||||
int fimg_filter_3x3(FloatImg *src, FloatImg *dst, FimgFilter3x3 *filtr)
|
||||
{
|
||||
@@ -35,6 +63,10 @@ if (fimg_images_not_compatible(src, dst)) {
|
||||
return -98;
|
||||
}
|
||||
|
||||
if (verbosity) {
|
||||
fimg_show_filter("essai", filtr);
|
||||
}
|
||||
|
||||
/* aliasing some vars for cleaner code */
|
||||
pr = src->R; pg = src->G; pb = src->B;
|
||||
w = src->width; h = src->height;
|
||||
|
||||
0
funcs/fimg-dicom.c
Normal file
0
funcs/fimg-dicom.c
Normal file
@@ -17,6 +17,12 @@
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
/*
|
||||
https://baillehachepascal.dev/2021/rgb_hsv.php
|
||||
|
||||
|
||||
|
||||
*/
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* helper functions */
|
||||
static float maxi3f(float a, float b, float c)
|
||||
@@ -29,7 +35,7 @@ return ((a < b)? (a < c ? a : c) : (b < c ? b : c));
|
||||
}
|
||||
static int pseudoeq(float a, float b)
|
||||
{
|
||||
return (fabsf(a-b)<0.00000000000001); // UGLY HACK ???
|
||||
return (fabsf(a-b)<0.00000001); // UGLY HACK ???
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
|
||||
@@ -24,7 +24,8 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
|
||||
Histo, Hsv, Classif, Ctr2x2, Qsortrgb,
|
||||
Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
|
||||
Geometrie, FileType, Mirror, KillRGB,
|
||||
Pixelize,SplitLevel,DecompRgbz, Rectangle };
|
||||
Pixelize,SplitLevel, DecompRgbz, DecompRgbg,
|
||||
Rectangle };
|
||||
typedef struct {
|
||||
char *name;
|
||||
int Cmd;
|
||||
@@ -56,6 +57,7 @@ Command commands[] = {
|
||||
{ "pixelize", Pixelize },
|
||||
{ "spltlvl", SplitLevel },
|
||||
{ "decomprgbz", DecompRgbz },
|
||||
{ "decomprgbg", DecompRgbg },
|
||||
{ "rectangle", Rectangle },
|
||||
{ NULL, 0 }
|
||||
} ;
|
||||
@@ -234,6 +236,9 @@ switch(opt) {
|
||||
case DecompRgbz:
|
||||
foo = essai_decomprgb_color(filename, outfile);
|
||||
break;
|
||||
case DecompRgbg:
|
||||
foo = essai_decomprgb_gray(filename, outfile);
|
||||
break;
|
||||
case Rectangle:
|
||||
essai_rectangle(outfile, 0);
|
||||
break;
|
||||
|
||||
@@ -74,6 +74,38 @@ if (foo) {
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int essai_decomprgb_gray(char *inf, char *outf)
|
||||
{
|
||||
int foo;
|
||||
FloatImg src, dst;
|
||||
|
||||
fprintf(stderr, ">>> %s ( %s %s )\n", __func__, inf, outf);
|
||||
|
||||
foo = fimg_create_from_dump(inf, &src);
|
||||
if (0 != foo) {
|
||||
fprintf(stderr, "%s: err %d loading image '%s'\n", __func__,
|
||||
foo, inf);
|
||||
return foo;
|
||||
}
|
||||
fimg_clone(&src, &dst, 1);
|
||||
|
||||
foo = fimg_decomp_rgbz_gray(&src, &dst, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s:%s(): fail %d line %d\n",
|
||||
__FILE__, __func__, foo, __LINE__);
|
||||
return foo;
|
||||
}
|
||||
|
||||
foo = fimg_export_picture(&dst, outf, 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
fimg_destroy(&src); fimg_destroy(&dst);
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int essai_decomprgb_color(char *inf, char *outf)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ int essai_plasma(char *infile, char *outfile, int ikoef, float fkoef);
|
||||
int essai_miroir(char *inf, char *outf, int flags);
|
||||
int essai_killrgb(char *inf, char *outf);
|
||||
int essai_decomprgb_color(char *inf, char *outf);
|
||||
int essai_decomprgb_gray(char *inf, char *outf);
|
||||
int essai_split_level(char *inf, char *outf, int flags);
|
||||
|
||||
int essai_displacement(char *infile, char *outfile);
|
||||
|
||||
Reference in New Issue
Block a user