Commit e86e1b6f authored by Paal Kvamme's avatar Paal Kvamme
Browse files

Python tools: Allow copying a file that has no world coordinates defined.

parent 25527d2c
......@@ -85,7 +85,12 @@ def copy(srcfilename, dstfilename, crop_offset=None, crop_size=None, crop_center
[ crop_end[0], crop_beg[1] ],
[ crop_beg[0], crop_end[1] ],
[ crop_end[0], crop_end[1] ] ]
world_corners = [ r.indexToWorld(tuple(x)) for x in index_corners ]
try:
world_corners = [ r.indexToWorld(tuple(x)) for x in index_corners ]
except Exception:
# World coordinates bad, e.g. all might have been zero.
# Keeping the original corners can hardly make it worse.
world_corners = [ [0, 0], [0, 0], [0, 0], [0, 0] ]
annotstart = r.indexToAnnot((crop_beg[0], crop_beg[1]))
zstart = r.zstart + crop_beg[2] * r.zinc
# Optionally change the datatype (given in bytes per sample)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment