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)
Exemple #2
0
 def request( self, qrect, along_through=None ):
     assert isinstance(qrect, QRect)
     # Widen request with a 1-pixel halo, to make sure edges on the tile borders are shown.
     qrect = QRect( qrect.x(), qrect.y(), qrect.width()+1, qrect.height()+1 )
     s = rect2slicing(qrect)
     arrayreq = self._arraySource2D.request(s, along_through)
     return SegmentationEdgesItemRequest(arrayreq, self._layer, qrect)
Exemple #3
0
 def request(self, qrect, along_through=None):
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     req = self._arraySource2D.request(s, along_through)
     return GrayscaleImageRequest(req,
                                  self._layer.normalize[0],
                                  direct=self.direct)
Exemple #4
0
 def request( self, qrect, along_through=None ):
     assert isinstance(qrect, QRect)
     # Widen request with a 1-pixel halo, to make sure edges on the tile borders are shown.
     qrect = QRect( qrect.x(), qrect.y(), qrect.width()+1, qrect.height()+1 )
     s = rect2slicing(qrect)
     arrayreq = self._arraySource2D.request(s, along_through)
     return SegmentationEdgesItemRequest(arrayreq, self._layer, qrect)
    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)
Exemple #6
0
 def request(self, qrect, along_through=None):
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     r = self._channels[0].request(s, along_through)
     g = self._channels[1].request(s, along_through)
     b = self._channels[2].request(s, along_through)
     a = self._channels[3].request(s, along_through)
     shape = list(slicing2shape(s))
     assert len(shape) == 2
     assert all([x > 0 for x in shape])
     return RGBAImageRequest(r, g, b, a, shape, *self._layer._normalize)
Exemple #7
0
 def request(self, qrect, along_through=None):
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     r = self._channels[0].request(s, along_through)
     g = self._channels[1].request(s, along_through)
     b = self._channels[2].request(s, along_through)
     a = self._channels[3].request(s, along_through)
     shape = list(slicing2shape(s))
     assert len(shape) == 2
     assert all([x > 0 for x in shape])
     return RGBAImageRequest(r, g, b, a, shape, *self._layer._normalize)
Exemple #8
0
 def request( self, qrect, through=None ):
     if cfg.getboolean('pixelpipeline', 'verbose'):
         volumina.printLock.acquire()
         print Fore.RED + "  ColortableImageSource '%s' requests (x=%d, y=%d, w=%d, h=%d) = %r" \
         % (self.objectName(), qrect.x(), qrect.y(), qrect.width(), qrect.height(), rect2slicing(qrect)) \
         + Fore.RESET
         volumina.printLock.release()
         
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     req = self._arraySource2D.request(s, through)
     return ColortableImageRequest( req, self._colorTable, self.direct )
Exemple #9
0
 def request( self, qrect, along_through=None ):
     if cfg.getboolean('pixelpipeline', 'verbose'):
         volumina.printLock.acquire()
         print Fore.RED + "  GrayscaleImageSource '%s' requests (x=%d, y=%d, w=%d, h=%d)" \
         % (self.objectName(), qrect.x(), qrect.y(), qrect.width(), qrect.height()) \
         + Fore.RESET
         volumina.printLock.release()
         
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     req = self._arraySource2D.request(s, along_through)
     return GrayscaleImageRequest( req, self._layer.normalize[0], direct=self.direct )
Exemple #10
0
 def request( self, qrect, along_through=None ):
     if cfg.getboolean('pixelpipeline', 'verbose'):
         volumina.printLock.acquire()
         print Fore.RED + "  ColortableImageSource '%s' requests (x=%d, y=%d, w=%d, h=%d) = %r" \
         % (self.objectName(), qrect.x(), qrect.y(), qrect.width(), qrect.height(), rect2slicing(qrect)) \
         + Fore.RESET
         volumina.printLock.release()
         
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     req = self._arraySource2D.request(s, along_through)
     return ColortableImageRequest( req, self._colorTable, self._layer.normalize[0], self.direct )
Exemple #11
0
 def request( self, qrect ):
     if cfg.getboolean('pixelpipeline', 'verbose'):
         volumina.printLock.acquire()
         print Fore.RED + "  AlphaModulatedImageSource '%s' requests (x=%d, y=%d, w=%d, h=%d)" \
         % (self.objectName(), qrect.x(), qrect.y(), qrect.width(), qrect.height()) \
         + Fore.RESET
         volumina.printLock.release()
         
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     req = self._arraySource2D.request(s)
     return AlphaModulatedImageRequest( req, self._layer.tintColor, self._layer.normalize[0] )
Exemple #12
0
 def request( self, qrect, along_through=None ):
     if cfg.getboolean('pixelpipeline', 'verbose'):
         volumina.printLock.acquire()
         print Fore.RED + "  RGBAImageSource '%s' requests (x=%d, y=%d, w=%d, h=%d)" \
         % (self.objectName(), qrect.x(), qrect.y(), qrect.width(), qrect.height()) \
          + Fore.RESET
         volumina.printLock.release()
         
     assert isinstance(qrect, QRect)
     s = rect2slicing( qrect )
     r = self._channels[0].request(s, along_through)
     g = self._channels[1].request(s, along_through)
     b = self._channels[2].request(s, along_through)
     a = self._channels[3].request(s, along_through)
     shape = list( slicing2shape(s) )
     assert len(shape) == 2
     assert all([x > 0 for x in shape])
     return RGBAImageRequest( r, g, b, a, shape, *self._layer._normalize )
Exemple #13
0
 def request( self, qrect, along_through=None ):
     if cfg.getboolean('pixelpipeline', 'verbose'):
         volumina.printLock.acquire()
         print Fore.RED + "  RGBAImageSource '%s' requests (x=%d, y=%d, w=%d, h=%d)" \
         % (self.objectName(), qrect.x(), qrect.y(), qrect.width(), qrect.height()) \
          + Fore.RESET
         volumina.printLock.release()
         
     assert isinstance(qrect, QRect)
     s = rect2slicing( qrect )
     r = self._channels[0].request(s, along_through)
     g = self._channels[1].request(s, along_through)
     b = self._channels[2].request(s, along_through)
     a = self._channels[3].request(s, along_through)
     shape = list( slicing2shape(s) )
     assert len(shape) == 2
     assert all([x > 0 for x in shape])
     return RGBAImageRequest( r, g, b, a, shape, *self._layer._normalize )
Exemple #14
0
 def request( self, qrect ):
     if cfg.getboolean('pixelpipeline', 'verbose'):
         volumina.printLock.acquire()
         print Fore.RED + "  RGBAImageSource '%s' requests (x=%d, y=%d, w=%d, h=%d)" \
         % (self.objectName(), qrect.x(), qrect.y(), qrect.width(), qrect.height()) \
          + Fore.RESET
         volumina.printLock.release()
         
     assert isinstance(qrect, QRect)
     s = rect2slicing( qrect )
     r = self._channels[0].request(s)
     g = self._channels[1].request(s)
     b = self._channels[2].request(s)
     a = self._channels[3].request(s)
     shape = []
     for t in slicing2shape(s):
         if t > 1:
             shape.append(t)
     assert len(shape) == 2
     return RGBAImageRequest( r, g, b, a, shape, *self._layer._normalize )
 def test_rect2slicing(self):
     slicing = st.rect2slicing(self.qrect)
     self.assertEquals(slicing, self.slicing)
Exemple #16
0
 def request(self, qrect, along_through=None):
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     req = self._arraySource2D.request(s, along_through)
     return AlphaModulatedImageRequest(req, self._layer.tintColor,
                                       self._layer.normalize[0])
Exemple #17
0
 def request( self, qrect, along_through=None ):
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     arrayreq = self._arraySource2D.request(s, along_through)
     return DummyItemRequest(arrayreq, qrect)
Exemple #18
0
 def request( self, qrect, along_through=None ):
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     shape = slicing2shape( s )
     return RandomImageRequest( shape )
 def test_rect2slicing(self):
     slicing = st.rect2slicing(self.qrect)
     self.assertEquals(slicing, self.slicing)
Exemple #20
0
 def request(self, qrect, along_through=None):
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     req = self._arraySource2D.request(s, along_through)
     return ColortableImageRequest(req, self._colorTable, self._layer.normalize[0], self.direct)
Exemple #21
0
 def request(self, qrect, along_through=None):
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     shape = slicing2shape(s)
     return RandomImageRequest(shape)
Exemple #22
0
 def request(self, qrect, along_through=None):
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     arrayreq = self._arraySource2D.request(s, along_through)
     return DummyItemRequest(arrayreq, qrect)
Exemple #23
0
 def request(self, qrect, along_through=None):
     assert isinstance(qrect, QRect)
     s = rect2slicing(qrect)
     req = self._arraySource2D.request(s, along_through)
     return AlphaModulatedImageRequest(req, self._layer.tintColor, self._layer.normalize[0])