make im_spcor[12] static, im_spcor is wrapper
This commit is contained in:
parent
19c9cccbfc
commit
46f4cd5800
@ -274,8 +274,6 @@ int im_fastcor( IMAGE *, IMAGE *, IMAGE * );
|
|||||||
int im_fastcor_raw( IMAGE *, IMAGE *, IMAGE * );
|
int im_fastcor_raw( IMAGE *, IMAGE *, IMAGE * );
|
||||||
int im_spcor( IMAGE *, IMAGE *, IMAGE * );
|
int im_spcor( IMAGE *, IMAGE *, IMAGE * );
|
||||||
int im_spcor_raw( IMAGE *, IMAGE *, IMAGE * );
|
int im_spcor_raw( IMAGE *, IMAGE *, IMAGE * );
|
||||||
int im_spcor2( IMAGE *, IMAGE *, IMAGE * );
|
|
||||||
int im_spcor2_raw( IMAGE *, IMAGE *, IMAGE * );
|
|
||||||
int im_gradcor( IMAGE *, IMAGE *, IMAGE * );
|
int im_gradcor( IMAGE *, IMAGE *, IMAGE * );
|
||||||
int im_gradcor_raw( IMAGE *, IMAGE *, IMAGE * );
|
int im_gradcor_raw( IMAGE *, IMAGE *, IMAGE * );
|
||||||
int im_contrast_surface( IMAGE *, IMAGE *, int, int );
|
int im_contrast_surface( IMAGE *, IMAGE *, int, int );
|
||||||
|
@ -1007,44 +1007,6 @@ static im_function spcor_raw_desc = {
|
|||||||
two_in_one_out /* Arg list */
|
two_in_one_out /* Arg list */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Call im_spcor2 via arg vector.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
spcor2_vec( im_object *argv )
|
|
||||||
{
|
|
||||||
return( im_spcor2( argv[0], argv[1], argv[2] ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Description of im_spcor2.
|
|
||||||
*/
|
|
||||||
static im_function spcor2_desc = {
|
|
||||||
"im_spcor2", /* Name */
|
|
||||||
"normalised correlation of in2 within in1",
|
|
||||||
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
|
|
||||||
spcor2_vec, /* Dispatch function */
|
|
||||||
IM_NUMBER( two_in_one_out ), /* Size of arg list */
|
|
||||||
two_in_one_out /* Arg list */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Call im_spcor2_raw via arg vector.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
spcor2_raw_vec( im_object *argv )
|
|
||||||
{
|
|
||||||
return( im_spcor2_raw( argv[0], argv[1], argv[2] ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Description of im_spcor2_raw.
|
|
||||||
*/
|
|
||||||
static im_function spcor2_raw_desc = {
|
|
||||||
"im_spcor2_raw", /* Name */
|
|
||||||
"normalised correlation of in2 within in1, no black padding",
|
|
||||||
IM_FN_PIO | IM_FN_TRANSFORM, /* Flags */
|
|
||||||
spcor2_raw_vec, /* Dispatch function */
|
|
||||||
IM_NUMBER( two_in_one_out ), /* Size of arg list */
|
|
||||||
two_in_one_out /* Arg list */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Args for im_zerox.
|
/* Args for im_zerox.
|
||||||
*/
|
*/
|
||||||
static im_arg_desc zerox_args[] = {
|
static im_arg_desc zerox_args[] = {
|
||||||
@ -1392,8 +1354,6 @@ static im_function *convol_list[] = {
|
|||||||
&shrink_desc,
|
&shrink_desc,
|
||||||
&spcor_desc,
|
&spcor_desc,
|
||||||
&spcor_raw_desc,
|
&spcor_raw_desc,
|
||||||
&spcor2_desc,
|
|
||||||
&spcor2_raw_desc,
|
|
||||||
&stretch3_desc,
|
&stretch3_desc,
|
||||||
&zerox_desc
|
&zerox_desc
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
* @(#)
|
* @(#)
|
||||||
* @(#) Returns 0 on sucess and -1 on error.
|
* @(#) Returns 0 on sucess and -1 on error.
|
||||||
*
|
*
|
||||||
* Copyright: 1990, N. Dessipris.
|
* Copyright: 1990, N. Dessipris; 2006, 2007 Nottingham Trent University.
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* Author: Nicos Dessipris
|
* Author: Nicos Dessipris
|
||||||
* Written on: 02/05/1990
|
* Written on: 02/05/1990
|
||||||
@ -39,6 +40,12 @@
|
|||||||
* - sets Xoffset / Yoffset
|
* - sets Xoffset / Yoffset
|
||||||
* 8/3/06 JC
|
* 8/3/06 JC
|
||||||
* - use im_embed() with edge stretching on the input, not the output
|
* - use im_embed() with edge stretching on the input, not the output
|
||||||
|
*
|
||||||
|
* 2006-10-24 tcv
|
||||||
|
* - add im_spcor2
|
||||||
|
*
|
||||||
|
* 2007-11-12 tcv
|
||||||
|
* - make im_spcor a wrapper selecting either im__spcor1 or im__spcor2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -113,6 +120,11 @@ static void *spcor2_start( IMAGE *r, void *a, void *b );
|
|||||||
static int spcor2_gen( REGION *r, void *seq, void *a, void *b );
|
static int spcor2_gen( REGION *r, void *seq, void *a, void *b );
|
||||||
static int spcor2_stop( void *seq, void *a, void *b );
|
static int spcor2_stop( void *seq, void *a, void *b );
|
||||||
|
|
||||||
|
/* spcor1 generate function.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
spcor1_gen( REGION *or, void *seq, void *a, void *b )
|
||||||
|
{
|
||||||
#define LOOP(IN) \
|
#define LOOP(IN) \
|
||||||
{ \
|
{ \
|
||||||
IN *a = (IN *) p; \
|
IN *a = (IN *) p; \
|
||||||
@ -152,12 +164,6 @@ static int spcor2_stop( void *seq, void *a, void *b );
|
|||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* spcor generate function.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
spcor_gen( REGION *or, void *seq, void *a, void *b )
|
|
||||||
{
|
|
||||||
REGION *ir = (REGION *) seq;
|
REGION *ir = (REGION *) seq;
|
||||||
SpcorInfo *inf = (SpcorInfo *) b;
|
SpcorInfo *inf = (SpcorInfo *) b;
|
||||||
IMAGE *ref = inf->ref;
|
IMAGE *ref = inf->ref;
|
||||||
@ -202,7 +208,7 @@ spcor_gen( REGION *or, void *seq, void *a, void *b )
|
|||||||
case IM_BANDFMT_USHORT: LOOP(unsigned short); break;
|
case IM_BANDFMT_USHORT: LOOP(unsigned short); break;
|
||||||
case IM_BANDFMT_SHORT: LOOP(signed short); break;
|
case IM_BANDFMT_SHORT: LOOP(signed short); break;
|
||||||
default:
|
default:
|
||||||
error_exit( "im_spcor: internal error #7934" );
|
error_exit( "im_spcor1: internal error #7934" );
|
||||||
|
|
||||||
/* Keep gcc -Wall happy.
|
/* Keep gcc -Wall happy.
|
||||||
*/
|
*/
|
||||||
@ -219,6 +225,7 @@ spcor_gen( REGION *or, void *seq, void *a, void *b )
|
|||||||
}
|
}
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
#undef LOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pre-calculate stuff for our reference image.
|
/* Pre-calculate stuff for our reference image.
|
||||||
@ -252,8 +259,8 @@ make_inf( IMAGE *out, IMAGE *ref )
|
|||||||
return( inf );
|
return( inf );
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
im_spcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out )
|
im__spcor1_raw( IMAGE *in, IMAGE *ref, IMAGE *out )
|
||||||
{
|
{
|
||||||
SpcorInfo *inf;
|
SpcorInfo *inf;
|
||||||
|
|
||||||
@ -265,7 +272,7 @@ im_spcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out )
|
|||||||
/* Check sizes.
|
/* Check sizes.
|
||||||
*/
|
*/
|
||||||
if( in->Xsize < ref->Xsize || in->Ysize < ref->Ysize ) {
|
if( in->Xsize < ref->Xsize || in->Ysize < ref->Ysize ) {
|
||||||
im_errormsg( "im_spcor_raw: ref not smaller than in" );
|
im_errormsg( "im_spcor1_raw: ref not smaller than in" );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,13 +281,13 @@ im_spcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out )
|
|||||||
if( in->Coding != IM_CODING_NONE || in->Bands != 1 ||
|
if( in->Coding != IM_CODING_NONE || in->Bands != 1 ||
|
||||||
ref->Coding != IM_CODING_NONE || ref->Bands != 1 ||
|
ref->Coding != IM_CODING_NONE || ref->Bands != 1 ||
|
||||||
in->BandFmt != ref->BandFmt ) {
|
in->BandFmt != ref->BandFmt ) {
|
||||||
im_errormsg( "im_spcor_raw: input not uncoded 1 band" );
|
im_errormsg( "im_spcor1_raw: input not uncoded 1 band" );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
if( in->BandFmt != IM_BANDFMT_UCHAR &&
|
if( in->BandFmt != IM_BANDFMT_UCHAR &&
|
||||||
in->BandFmt != IM_BANDFMT_SHORT &&
|
in->BandFmt != IM_BANDFMT_SHORT &&
|
||||||
in->BandFmt != IM_BANDFMT_USHORT ) {
|
in->BandFmt != IM_BANDFMT_USHORT ) {
|
||||||
im_errormsg( "im_spcor_raw: input not char/short/ushort" );
|
im_errormsg( "im_spcor1_raw: input not char/short/ushort" );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +314,7 @@ im_spcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out )
|
|||||||
/* Write the correlation.
|
/* Write the correlation.
|
||||||
*/
|
*/
|
||||||
if( im_generate( out,
|
if( im_generate( out,
|
||||||
im_start_one, spcor_gen, im_stop_one, in, inf ) )
|
im_start_one, spcor1_gen, im_stop_one, in, inf ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
out->Xoffset = -ref->Xsize / 2;
|
out->Xoffset = -ref->Xsize / 2;
|
||||||
@ -318,17 +325,17 @@ im_spcor_raw( IMAGE *in, IMAGE *ref, IMAGE *out )
|
|||||||
|
|
||||||
/* The above, with the input expanded to make out the same size as in.
|
/* The above, with the input expanded to make out the same size as in.
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
im_spcor( IMAGE *in, IMAGE *ref, IMAGE *out )
|
im__spcor1( IMAGE *in, IMAGE *ref, IMAGE *out )
|
||||||
{
|
{
|
||||||
IMAGE *t1 = im_open_local( out, "im_spcor intermediate", "p" );
|
IMAGE *t1 = im_open_local( out, "im_spcor1 intermediate", "p" );
|
||||||
|
|
||||||
if( !t1 ||
|
if( !t1 ||
|
||||||
im_embed( in, t1, 1,
|
im_embed( in, t1, 1,
|
||||||
ref->Xsize / 2, ref->Ysize / 2,
|
ref->Xsize / 2, ref->Ysize / 2,
|
||||||
in->Xsize + ref->Xsize - 1,
|
in->Xsize + ref->Xsize - 1,
|
||||||
in->Ysize + ref->Ysize - 1 ) ||
|
in->Ysize + ref->Ysize - 1 ) ||
|
||||||
im_spcor_raw( t1, ref, out ) )
|
im__spcor1_raw( t1, ref, out ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
out->Xoffset = 0;
|
out->Xoffset = 0;
|
||||||
@ -337,13 +344,13 @@ im_spcor( IMAGE *in, IMAGE *ref, IMAGE *out )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
im_spcor2_raw(
|
im__spcor2_raw(
|
||||||
IMAGE *f,
|
IMAGE *f,
|
||||||
IMAGE *w,
|
IMAGE *w,
|
||||||
IMAGE *r
|
IMAGE *r
|
||||||
){
|
){
|
||||||
#define FUNCTION_NAME "im_spcor_raw"
|
#define FUNCTION_NAME "im_spcor2_raw"
|
||||||
|
|
||||||
DOUBLEMASK *w_stats;
|
DOUBLEMASK *w_stats;
|
||||||
spcor2_w_inf *w_inf;
|
spcor2_w_inf *w_inf;
|
||||||
@ -533,8 +540,8 @@ spcor2_stop( void *vseq, void *a, void *b ){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
im_spcor2( IMAGE *in, IMAGE *ref, IMAGE *out )
|
im__spcor2( IMAGE *in, IMAGE *ref, IMAGE *out )
|
||||||
{
|
{
|
||||||
IMAGE *t1 = im_open_local( out, "im_spcor2 intermediate", "p" );
|
IMAGE *t1 = im_open_local( out, "im_spcor2 intermediate", "p" );
|
||||||
|
|
||||||
@ -543,7 +550,7 @@ im_spcor2( IMAGE *in, IMAGE *ref, IMAGE *out )
|
|||||||
ref->Xsize / 2, ref->Ysize / 2,
|
ref->Xsize / 2, ref->Ysize / 2,
|
||||||
in->Xsize + ref->Xsize - 1,
|
in->Xsize + ref->Xsize - 1,
|
||||||
in->Ysize + ref->Ysize - 1 ) ||
|
in->Ysize + ref->Ysize - 1 ) ||
|
||||||
im_spcor2_raw( t1, ref, out ) )
|
im__spcor2_raw( t1, ref, out ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
out->Xoffset = 0;
|
out->Xoffset = 0;
|
||||||
@ -551,3 +558,35 @@ im_spcor2( IMAGE *in, IMAGE *ref, IMAGE *out )
|
|||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
im_spcor_raw(
|
||||||
|
IMAGE *f,
|
||||||
|
IMAGE *w,
|
||||||
|
IMAGE *r
|
||||||
|
){
|
||||||
|
if( im_incheck( w ))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if( 3 <= w-> Xsize || 3 <= w-> Ysize )
|
||||||
|
return im__spcor2( f, w, r );
|
||||||
|
|
||||||
|
else
|
||||||
|
return im__spcor1( f, w, r );
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
im_spcor(
|
||||||
|
IMAGE *f,
|
||||||
|
IMAGE *w,
|
||||||
|
IMAGE *r
|
||||||
|
){
|
||||||
|
if( im_incheck( w ))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if( 3 <= w-> Xsize || 3 <= w-> Ysize )
|
||||||
|
return im__spcor2( f, w, r );
|
||||||
|
|
||||||
|
else
|
||||||
|
return im__spcor1( f, w, r );
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user