00001 #include "sadie.h"
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 void EXPAND (
00013 IMAGE *in,
00014 double jfact,
00015 double kfact,
00016 double option,
00017
00018
00019
00020 IMAGE **out
00021
00022 ) { register short i;
00023 char msg[SLEN];
00024 double xc[3], yc[3];
00025
00026 if (TIMES) TIMING(T_EXPAND);
00027 if (NAMES) {
00028 MESSAGE('I',"");
00029 MESSAGE('I',"EXPAND");
00030 MESSAGE('I',"");
00031 sprintf(msg," Input image: %s",in->text);
00032 MESSAGE('I',msg);
00033 sprintf(msg," Scale factor: lines: %12.4e",jfact);
00034 MESSAGE('I',msg);
00035 sprintf(msg," pixels: %12.4e",kfact);
00036 MESSAGE('I',msg);
00037 if (option < 0.0) {
00038 sprintf(msg," Parametric cubic interpolation, alpha = %5.2f",option);
00039 MESSAGE('I',msg);
00040 } else if (option == 0.0) {
00041 MESSAGE('I'," Bilinear interpolation");
00042 } else if (option > 0.0) {
00043 MESSAGE('I'," Nearest-neighbor interpolation");
00044 }
00045 MESSAGE('I'," ...............");
00046 }
00047
00048
00049 if (!CHECKIMG(in)) {
00050 MESSAGE('E'," Can't identify image.");
00051 goto the_end;
00052 } else if (jfact <= 0.0) {
00053 MESSAGE('E'," Line scaling factor must be greater than zero.");
00054 goto the_end;
00055 } else if (kfact <= 0.0) {
00056 MESSAGE('E'," Pixel scaling factor must be greater than zero.");
00057 goto the_end;
00058 }
00059
00060
00061 if (jfact == (double)((short)jfact) && kfact == (double)((short)kfact) && option > 0.0) {
00062 DUPL(in,0,0,0,1,(short)jfact,(short)kfact,in->nbnd,in->nlin,in->npix,out);
00063 } else {
00064 for (i=0; i<3; xc[i]=yc[i]=0.0,i++);
00065 xc[1] = 1.0/kfact;
00066 yc[2] = 1.0/jfact;
00067 GEOMWARP(in,in->nbnd,(short)ceil(jfact*(double)in->nlin),(short)ceil(kfact*(double)in->npix),xc,yc,3,option,(PIXEL)SMIN,out);
00068 }
00069
00070 the_end:
00071 if (TIMES) TIMING(T_EXIT);
00072 }