Debian Codegraph @

test/pytest_copyimage.py

raw symbols SCIP
1 ###############################################################################
2 # pytest_copyimage.py: Copy image
3 # Author(s): [email protected]
4 # Copyright (c) 2016-2019 European Union (Joint Research Centre)
5 # License EUPLv1.2
6 #
7 # This file is part of jiplib
8 ###############################################################################
9
10 # History
11 # 2017/10/24 - Created by Pieter Kempeneers ([email protected])
12 # Change log
13
14 import argparse
15 import jiplib as jl
16
17 parser=argparse.ArgumentParser()
18 parser.add_argument("-nrow","--nrow",help="Number of rows",dest="nrow",required=False,type=int,default=1024)
19 parser.add_argument("-ncol","--ncol",help="Number of cols",dest="ncol",required=False,type=int,default=1024)
20 parser.add_argument("-min","--min",help="min value for pixel values",dest="min",required=False,type=float,default=1000)
21 parser.add_argument("-max","--max",help="max value for pixel values",dest="max",required=False,type=float,default=2000)
22 args = parser.parse_args()
23
24 ULX=600000.0
25 ULY=4000020.0
26 LRX=709800.0
27 LRY=3890220.0
28 projection='epsg:32612'
29 dict={'ulx':ULX,'uly':ULY,'lrx':LRX,'lry':LRY,'a_srs':projection}
30 dict.update({'nrow':args.nrow,'ncol':args.ncol})
31 dict.update({'uniform':[args.min,args.max+1]})
32 dict.update({'otype':'GDT_UInt16'})
33 dict.update({'seed':10915})
34 try:
35 jim0=jl.createJim(**dict)
36 #create a copy
37 jim1=jl.createJim(jim0)
38 if not jim1.isEqual(jim0):
39 print("Failed: isEqual")
40 throw()
41 jim0.d_pointOpBlank(500)
42 if jim1.isEqual(jim0):
43 print("Failed: isEqual")
44 throw()
45 jim1.d_pointOpBlank(2000)
46 jim0.close()
47 theStats=jim1.getStats({'function':['max']})
48 if theStats['max']!=2000:
49 print("Failed: max")
50 throw()
51 print("Success: copy image")
52 except:
53 print("Failed: copy image")
54 jim1.close()