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

Method load

imagepy/menus/Image/Adjust/brightcons_plg.py:27–46  ·  view source on GitHub ↗
(self, ips)

Source from the content-addressed store, hash-verified

25 note = ['all', 'auto_msk', 'auto_snap', 'not_channel', 'preview']
26
27 def load(self, ips):
28 hist = np.histogram(self.ips.lookup(),list(range(257)))[0]
29 if ips.imgtype in ('8-bit', 'rgb'):
30 self.arange = (0, 255)
31 self.para = {'bright':0, 'contrast':45}
32 self.view = [('hist', 'hist', hist),
33 ('slide', 'bright', (-100,100), 0, 'Brightness'),
34 ('slide', 'contrast', (1,89), 0, 'Contrast')]
35 if 'not_slice' in self.note:
36 self.note.remove('not_slice')
37 else :
38 self.arange = minv, maxv = ips.img.min(), ips.img.max()
39 self.para = {'bright':np.mean(ips.range) - np.mean(self.arange),
40 'contrast':round(np.arctan((maxv-minv)/(ips.range[1]-ips.range[0]))/np.pi*180)}
41 self.view = [('hist', 'hist', hist),
42 ('slide', 'bright', (-(maxv-minv)/2, (maxv-minv)/2), 10, 'Brightness'),
43 ('slide', 'contrast', (1,89), 0, 'Contrast')]
44 if not 'not_slice' in self.note:
45 self.note.append('not_slice')
46 return True
47
48 def show(self, temp=ThresholdDialog):
49 dialog = lambda win, title, lim = self.ips.range:temp(win, title, lim)

Callers

nothing calls this directly

Calls 4

histogramMethod · 0.80
appendMethod · 0.80
lookupMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected