def isis2std_grayscale(from_cube, to_tiff, format="tiff", bittype="u16bit", minimum=None, maximum=None, maxpercent=99.999, cleanup_print_file=True): cmd = "isis2std" params = { "from": "%s+1" % from_cube, "to": to_tiff, "format": format, "bittype": bittype } if minimum is not None and maximum is not None: params["stretch"] = "manual" params["minimum"] = minimum params["maximum"] = maximum else: params["maxpercent"] = maxpercent s = isis_command(cmd, params) if cleanup_print_file: dirname = os.path.dirname(to_tiff) if len(dirname) > 0: dirname += "/" if os.path.exists("%sprint.prt" % dirname): os.unlink("%sprint.prt" % dirname) return s
def map2cam(from_cube, to_cube, cam): params = { "from": from_cube, "to": to_cube, "match": cam } s = isis_command("map2cam", params) return s
def fillgap(from_cube, to_cube, interp="cubic", direction="sample"): s = isis_command("fillgap", { "from": from_cube, "to": to_cube, "interp": interp, "direction": direction }) return s
def cam2cam(from_cube, to_cube, match_cube, interp="CUBICCONVOLUTION"): params = { "from": from_cube, "to": to_cube, "match": match_cube, "interp": interp } s = isis_command("cam2cam", params) return s
def map2map(from_cube, to_cube, map): params = { "from": from_cube, "to": to_cube, "map": map, "pixres": "map" } s = isis_command("map2map", params) return s
def trim(from_cube, to_cube, top=2, bottom=2, left=2, right=2): s = isis_command("trim", { "from": from_cube, "to": to_cube, "top": top, "bottom": bottom, "left": left, "right": right }) return s
def caminfo(from_cube, to_pvl, isislabel=True, originallabel=True): cmd = "caminfo" params = { "from": from_cube, "to": to_pvl, "isislabel": ("yes" if isislabel is True else "no"), "originallabel": ("yes" if originallabel is True else "no") } s = isis_command(cmd, params) return s
def pad(from_file, to_file, left=0, right=0, bottom=0, top=0): params = { "from": from_file, "to": to_file, "top": top, "bottom": bottom, "left": left, "right": right } s = isis_command("pad", params) return s
def circle(from_cube, to_cube, rad=None): params = { "from": from_cube, "to": to_cube, } if rad is not None: params["rad"] = rad s = isis_command("circle", params) return s
def std2isis(from_file, to_file, mode=ColorMode.AUTO): params = { "from": from_file, "to": to_file, } if mode != ColorMode.AUTO: params["mode"] = mode s = isis_command("std2isis", params) return s
def junocam2isis(from_file, to_file, fullccd=False): params = { "from": from_file, "to": to_file } if fullccd is True: params["fullccd"] = "yes" s = isis_command("junocam2isis", params) return s
def remrx(from_cube, to_cube, action="null", resvalid="false", sdim=9, ldim=9): params = { "from": from_cube, "to": to_cube, "action": action, "resvalid": resvalid, "SDIM": sdim, "LDIM": ldim } s = isis_command("remrx", params) return s
def isis2pds(from_file, to_file, labtype="fixed", bittype="32bit", pdsversion="pds3"): params = { "from": from_file, "to": to_file, "labtype": labtype, "bittype": bittype, "pdsversion": pdsversion } s = isis_command("isis2pds", params) return s
def ringscam2map(from_cube, to_cube, projection="ringscylindrical", map=None, resolution="CAMERA"): if map is None: map = "%s/../data/base/templates/maps/%s.map"%(os.environ["ISISROOT"], projection) params = { "from": from_cube, "to": to_cube, "map": map } if resolution == "MAP": params["pixres"] = "map" s = isis_command("ringscam2map", params) return s
def isis2std_rgb(from_cube_red, from_cube_green, from_cube_blue, to_tiff, minimum=None, maximum=None, match_stretch=False, format="tiff", bittype="u16bit", maxpercent=99.999, cleanup_print_file=True): cmd = "isis2std" params = { "red": "%s+1" % from_cube_red, "green": "%s+1" % from_cube_green, "blue": "%s+1" % from_cube_blue, "to": to_tiff, "format": format, "bittype": bittype, "mode": "rgb" } if match_stretch and minimum is not None and maximum is not None: params.update({ "stretch": "manual", "rmin": minimum, "rmax": maximum, "gmin": minimum, "gmax": maximum, "bmin": minimum, "bmax": maximum }) else: params["maxpercent"] = maxpercent s = isis_command(cmd, params) if cleanup_print_file: dirname = os.path.dirname(to_tiff) if len(dirname) > 0: dirname += "/" if os.path.exists("%sprint.prt" % dirname): os.unlink("%sprint.prt" % dirname) return s
def get_data_min_max(from_cube): out = isis_command("stats", {"from": from_cube}) min = 0 max = 0 pattern = re.compile( r"^ *(?P<key>[a-zA-Z0-9]*)[ =]+(?P<value>[\-A-Z0-9.e]*)") for line in out.split("\n"): match = pattern.match(line) if match is not None: key = match.group("key") value = match.group("value") if key == "Minimum": min = float(value) elif key == "Maximum": max = float(value) return min, max
def noisefilter(from_cube, to_cube, toldef="stddev", tolmin=2.5, tolmax=2.5, replace="null", samples=5, lines=5): s = isis_command( "noisefilter", { "from": from_cube, "to": to_cube, "toldef": toldef, "tolmin": tolmin, "tolmax": tolmax, "replace": replace, "samples": samples, "lines": lines }) return s
def getkey(from_file_name, keyword, objname=None, grpname=None, verbose=False): if from_file_name[-3:].upper() == "IMQ": return __getkey_voy2isis(from_file_name, keyword, objname, grpname, verbose) else: try: cmd = "getkey" params = {"from": from_file_name, "keyword": keyword} if objname is not None: params["objname"] = objname if grpname is not None: params["grpname"] = grpname s = isis_command(cmd, params) return s.strip() except: if verbose is True: traceback.print_exc(file=sys.stdout) return None
def spiceinit(from_cube, is_ringplane=False, spkpredict=False, ckpredicted=False, cknadir=False, web=False): params = { "from": from_cube } if web is True: params["web"] = "yes" if spkpredict is True: params["spkpredict"] = "yes" if ckpredicted is True: params["ckpredicted"] = "yes" if cknadir is True: params["cknadir"] = "yes" if is_ringplane is True: params["shape"] = "ringplane" s = isis_command("spiceinit", params) return s
def lowpass(from_cube, to_cube, samples=5, lines=3, filter="outside", null="yes", hrs="no", his="no", lrs="no", replacement="center"): s = isis_command( "lowpass", { "from": from_cube, "to": to_cube, "samples": samples, "lines": lines, "filter": filter, "null": null, "hrs": hrs, "his": his, "lrs": lrs, "replacement": replacement }) return s
def pds2isis(from_file, to_file): s = isis_command("pds2isis", {"from": from_file, "to": to_file}) return s
def catlab(from_file): s = isis_command("catlab", {"from": from_file}) return s
def stretch(from_file, to_file, null="0.0", lis="0.0"): params = {"from": from_file, "to": to_file, "null": null, "lis": lis} s = isis_command("stretch", params) return s
def cisscal(from_file, to_file, units="intensity"): params = {"from": from_file, "to": to_file} if units is not None: params["units"] = units s = isis_command("cisscal", params) return s
def gllssical(from_file, to_file): s = isis_command("gllssical", {"from": from_file, "to": to_file}) return s
def findrx(from_cube): s = isis_command("findrx", {"from": from_cube}) return s
def voycal(from_file, to_file): s = isis_command("voycal", {"from": from_file, "to": to_file}) return s
def histeq(from_cube, to_cube): s = isis_command("histeq", {"from": from_cube, "to": to_cube}) return s
def automos(from_list, to_file, priority=Priority.ONTOP): params = {"fromlist": from_list, "mosaic": to_file, "priority": priority} s = isis_command("automos", params) return s