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