ImageModel.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # miam import
  2. import miam.image.Image as MIMG
  3. import miam.image.imageType as MTYPE
  4. class ImageModel(object):
  5. """description of class"""
  6. def __init__(self, controller):
  7. # reference to image controller
  8. self.controller = controller
  9. # image gui model
  10. # a list of miam.image.Image
  11. # each new process give a new image append to the list self.image
  12. # the image displayed is self.currentImage
  13. self.currentImage =None # index of current image
  14. self.image = []
  15. # list of 'process'
  16. # version 0.1: simple dict list
  17. self.history = []
  18. pass
  19. # methods called by controller
  20. def readImage(self,filename):
  21. # read image
  22. self.image.append(MIMG.Image.readImage(filename))
  23. self.history.append({'readImage':filename})
  24. # default processing for HDR iamge
  25. if self.image[-1].type == MTYPE.imageType.HDR:
  26. self.image.append(self.image[-1].removeZeros(0.5))
  27. self.history.append({'removeZeros':'0.5'})
  28. self.currentImage = len(self.image) -1
  29. def getColorData(self):
  30. return self.image[self.currentImage].colorData
  31. def resize(self,size,anti_aliasing=True):
  32. #resize(self,size=(None,None),anti_aliasing=False)
  33. pass