MCPcopy Create free account
hub / github.com/Image-Py/imagepy / run

Method run

imagepy/menus/Process/calculator_plg.py:22–54  ·  view source on GitHub ↗
(self, ips, imgs, para = None)

Source from the content-addressed store, hash-verified

20 ('img', 'img2', 'image2', '')]
21
22 def run(self, ips, imgs, para = None):
23 ips1 = ImageManager.get(para['img1'])
24 ips2 = ImageManager.get(para['img2'])
25 ips1.snapshot()
26
27 sl1, sl2 = ips1.get_nslices(), ips2.get_nslices()
28 cn1, cn2 = ips1.get_nchannels(), ips2.get_nchannels()
29 if ips1.dtype != ips2.dtype:
30 IPy.alert('Two stack must be equal dtype!')
31 return
32 elif sl1>1 and sl2>1 and sl1!=sl2:
33 IPy.alert('Two stack must have equal slices!')
34 return
35 elif cn1>1 and cn2>1 and cn1!=cn2:
36 IPy.alert('Two stack must have equal channels!')
37 return
38
39 w, h = ips1.size, ips2.size
40 w, h = min(w[0], h[0]), min(w[1], h[1])
41 if sl1 == 1:
42 bliter.blit(ips1.get_subimg(), ips2.get_subimg(), mode=para['op'])
43 elif sl1>1 and sl2==1:
44 for i in range(sl1):
45 self.progress(i, sl1)
46 ss1, se1 = ips1.get_rect()
47 bliter.blit(ips1.imgs[i][ss1, se1], ips2.get_subimg(), mode=para['op'])
48 elif sl1>1 and sl2>1:
49 for i in range(sl1):
50 self.progress(i, sl1)
51 ss1, se1 = ips1.get_rect()
52 ss2, se2 = ips2.get_rect()
53 bliter.blit(ips1.imgs[i][ss1, se1], ips2.imgs[i][ss2, se2], mode=para['op'])
54 ips1.update()
55

Callers

nothing calls this directly

Calls 8

get_nslicesMethod · 0.80
get_nchannelsMethod · 0.80
get_subimgMethod · 0.80
get_rectMethod · 0.80
getMethod · 0.45
snapshotMethod · 0.45
progressMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected