Ejemplo n.º 1
0
    def get_visible_paths(self, position, display_plane):
        # TODO: Here we need to obtain the image using the data source object
        # if display_plane == 0:
        #     current_slice = numpy.transpose(numpy.array(self._overlay_image[0, position[0], :, :, 0], dtype=numpy.float32))
        # elif display_plane == 1:
        #     current_slice = numpy.array(self._overlay_image[0, :, position[1], :, 0], dtype=numpy.float32)
        # elif display_plane == 2:
        #     current_slice = numpy.array(self._overlay_image[0, :, :, position[2], 0], dtype=numpy.float32)
        #
        # return _image_processing.findEdgePaths(current_slice)

        # TODO: replace this by determination of the actual bounding box
        rq = self._overlay_layer.datasources[0].request(
            (slice(0, 1),
             slice(10, 70),
             slice(10, 70),
             slice(10, 70),
             slice(0, 1)
             ))

        print self.editor.imageViews[0].viewportRect()

        # Get request data and convert it into an array
        slc = numpy.asarray(rq.wait(), dtype=numpy.float32)
        # print slc.shape
        return _image_processing.findEdgePaths(slc[0, :, :, position[2], 0])
Ejemplo n.º 2
0
    def get_visible_paths(self, position, display_plane):
        if display_plane == 0:
            current_slice = numpy.transpose(numpy.array(self._overlay_image[0, position[0], :, :, 0], dtype=numpy.float32))
        elif display_plane == 1:
            current_slice = numpy.array(self._overlay_image[0, :, position[1], :, 0], dtype=numpy.float32)
        elif display_plane == 2:
            current_slice = numpy.array(self._overlay_image[0, :, :, position[2], 0], dtype=numpy.float32)

        return _image_processing.findEdgePaths(current_slice)
Ejemplo n.º 3
0
    def get_visible_paths(self, position, display_plane):
        if display_plane == 0:
            current_slice = numpy.transpose(
                numpy.array(self._overlay_image[0, position[0], :, :, 0],
                            dtype=numpy.float32))
        elif display_plane == 1:
            current_slice = numpy.array(self._overlay_image[0, :,
                                                            position[1], :, 0],
                                        dtype=numpy.float32)
        elif display_plane == 2:
            current_slice = numpy.array(self._overlay_image[0, :, :,
                                                            position[2], 0],
                                        dtype=numpy.float32)

        return _image_processing.findEdgePaths(current_slice)
Ejemplo n.º 4
0
    def get_visible_paths(self, position, display_plane):
        # TODO: Here we need to obtain the image using the data source object
        # if display_plane == 0:
        #     current_slice = numpy.transpose(numpy.array(self._overlay_image[0, position[0], :, :, 0], dtype=numpy.float32))
        # elif display_plane == 1:
        #     current_slice = numpy.array(self._overlay_image[0, :, position[1], :, 0], dtype=numpy.float32)
        # elif display_plane == 2:
        #     current_slice = numpy.array(self._overlay_image[0, :, :, position[2], 0], dtype=numpy.float32)
        #
        # return _image_processing.findEdgePaths(current_slice)

        # TODO: replace this by determination of the actual bounding box
        rq = self._overlay_layer.datasources[0].request(
            (slice(0, 1), slice(10, 70), slice(10, 70), slice(10,
                                                              70), slice(0,
                                                                         1)))

        print self.editor.imageViews[0].viewportRect()

        # Get request data and convert it into an array
        slc = numpy.asarray(rq.wait(), dtype=numpy.float32)
        # print slc.shape
        return _image_processing.findEdgePaths(slc[0, :, :, position[2], 0])
Ejemplo n.º 5
0
# labels = numpy.zeros((5, 4), dtype=numpy.float32)
# labels[:] = 3
# labels[:, 0] = 1
# labels[0:2, 1] = 1
# labels[0:2, 2:4] = 2
# labels[2, 1:3] = 2

# labels = numpy.zeros((10, 10), dtype=numpy.float32)
# labels[:] = 1
# labels[6:10, :] = 2
# labels[5, 0:3] = 2
# labels[5, 7:10] = 2

labels = numpy.zeros((10, 10), dtype=numpy.float32)
labels[:] = 1
labels[0:5, 0:5] = 2
# labels[0:5, 5:10] = 1

print labels
print _image_processing.findEdgePaths(labels)

back = (numpy.ones((500, 500, 500)) * 0).astype(numpy.uint8)
back[:] = 1
for i in range(0, 500, 50):
    back[i:i+50, :] = back[i:i+50, :] + i
    back[:, i:i+50] = back[:, i:i+50] + i
ol = (numpy.zeros((500, 500, 500))).astype(numpy.uint8)
ol[:] = back

print back
Ejemplo n.º 6
0
# labels = numpy.zeros((5, 4), dtype=numpy.float32)
# labels[:] = 3
# labels[:, 0] = 1
# labels[0:2, 1] = 1
# labels[0:2, 2:4] = 2
# labels[2, 1:3] = 2

# labels = numpy.zeros((10, 10), dtype=numpy.float32)
# labels[:] = 1
# labels[6:10, :] = 2
# labels[5, 0:3] = 2
# labels[5, 7:10] = 2

labels = numpy.zeros((10, 10), dtype=numpy.float32)
labels[:] = 1
labels[0:5, 0:5] = 2
# labels[0:5, 5:10] = 1

print labels
print _image_processing.findEdgePaths(labels)

back = (numpy.ones((500, 500, 500)) * 0).astype(numpy.uint8)
back[:] = 1
for i in range(0, 500, 50):
    back[i : i + 50, :] = back[i : i + 50, :] + i
    back[:, i : i + 50] = back[:, i : i + 50] + i
ol = (numpy.zeros((500, 500, 500))).astype(numpy.uint8)
ol[:] = back

print back