def test_slicing_rect_inversion(self): """Ensures that slicing2rect and rect2slicing are inverse operations. """ a = self.slicing b = st.slicing2rect(a) c = st.rect2slicing(b) self.assertEquals(a, c) a = self.qrect b = st.rect2slicing(a) c = st.slicing2rect(b) self.assertEquals(a, c)
def setDirty(self, slicing): """Mark a region of the image as dirty. slicing -- if one ore more slices in the slicing are unbounded, the whole image is marked dirty; since an image has two dimensions, only the first two slices in the slicing are used """ if not is_pure_slicing(slicing): raise Exception("dirty region: slicing is not pure") if not is_bounded(slicing): self.isDirty.emit(QRect()) # empty rect == everything is dirty else: self.isDirty.emit(slicing2rect(slicing))
def setDirty( self, slicing ): '''Mark a region of the image as dirty. slicing -- if one ore more slices in the slicing are unbounded, the whole image is marked dirty; since an image has two dimensions, only the first two slices in the slicing are used ''' if not is_pure_slicing(slicing): raise Exception('dirty region: slicing is not pure') if not is_bounded( slicing ): self.isDirty.emit(QRect()) # empty rect == everything is dirty else: self.isDirty.emit(slicing2rect( slicing ))
def test_slicing2rect(self): qrect = st.slicing2rect(self.slicing) self.assertEquals(qrect, self.qrect)