# Copyright restrictions apply - see stsdas$copyright.stsdas # include include # SHUFFLE -- Combine several lines into one long intermixed line. # # The lines are mixed together, that is, the first point from each line are # followed by the second point from each line, etc. # # B.Simon 03-Sep-87 Original procedure shuffle (in_ptr, out_image, factor) pointer in_ptr # i: Pointer to input image template char out_image[ARB] # i: Output image name int factor # i: Stepping factor char in_image[SZ_FNAME] bool junk int pix, step pointer imi, imo, inbuf, outbuf bool tp_fetch() long clktime() pointer immap(), imgl1r(), impl1r() real ahivr(), alovr() begin # Open output image as new copy of input image. junk = tp_fetch (in_ptr, in_image) imi = immap (in_image, READ_ONLY, NULL) imo = immap (out_image, NEW_COPY, imi) IM_LEN(imo,1) = IM_LEN(imi,1) * factor outbuf = impl1r (imo) do step = 1, factor { if (step > 1) { junk = tp_fetch (in_ptr, in_image) imi = immap (in_image, READ_ONLY, NULL) } inbuf = imgl1r (imi) do pix = 1, IM_LEN(imi, 1) Memr[outbuf+(pix-1)*factor+(step-1)] = Memr[inbuf+(pix-1)] call imunmap (imi) } IM_MIN(imo) = alovr (Memr[outbuf], IM_LEN(imo,1)) IM_MAX(imo) = ahivr (Memr[outbuf], IM_LEN(imo,1)) IM_LIMTIME(imo) = clktime (long(0)) call imunmap (imo) end