# Copyright restrictions apply - see stsdas$copyright.stsdas # include # STEP -- Divide data from one group into several image groups # # B.Simon 17-May-88 Original procedure step() #-- char in_list[SZ_LINE] # Name of the input image char out_list[SZ_LINE] # Name of the output image char step_var[8] # Name or value of the stepping factor bool mix # The way pixels should be combined int in_num, out_num, factor, ic pointer in_ptr, out_ptr pointer imi char in_image[SZ_FNAME] char in_file[SZ_FNAME] string wrongdimen "Image must be one dimensional" string groupnum "Wrong number of groups in output image" bool tp_fetch(), clgetb() int ctoi(), imgeti() pointer tp_open(), immap() begin # Read the task parameters call clgstr ("inimage", in_list, SZ_LINE) call clgstr ("outimage", out_list, SZ_LINE) call clgstr ("stepvar", step_var, 8) mix = clgetb ("mix") # Expand the image template into a list of images, each with one # group. Check that the image is one dimensional. in_ptr = tp_open (in_list, 0, in_num) call imgcluster (in_list, in_file, SZ_FNAME) imi = immap (in_file, READ_ONLY, 0) ic = 1 if (ctoi (step_var, ic, factor) == 0) factor = imgeti (imi, step_var) if (IM_NDIM(imi) != 1) { call tp_close (in_ptr) call error (1, wrongdimen) } call imunmap (imi) out_ptr = tp_open (out_list, in_num*factor, out_num) if (out_num != in_num*factor) { call tp_close (in_ptr) call tp_close (out_ptr) call error (1, groupnum) } while (tp_fetch (in_ptr, in_image)) { if (mix) call unmix (in_image, out_ptr, factor) else call split (in_image, out_ptr, factor) } # Close image lists and exit call tp_close(in_ptr) call tp_close(out_ptr) end