1

I have a 3d image and try to predict their slice outputs by using neural networks. The problem is that, after prediction, I would like to find a way to pack them back. I have an idea that uses grid method, however, I am not sure it is the best way to do it.

    fig=plt.figure(figsize=(20, 20))
    columns = rangex_of_crop
    rows = rangey_of_crop
    for i, x in enumerate(cropped_images):
        img = x
        fig.add_subplot(rows, columns, i+1)
        plt.axis('off')
        plt.imshow(np.squeeze(x))

    fig = plt.figure(figsize=(15, 15), frameon=False)
    plt.show()

The output must be np.array of whole image and we have to assume that slices can be different sizes (not one by one, all together i.e. the all splitted images can be 32x32 or 64x64):

enter image description here

vrd.gn
  • 198
  • 1
  • 18
  • What is a "slice output" of a 3D image? What do you mean by "pack them back"? What is the definition of "optimal" for you? – norok2 Sep 12 '18 at 13:59
  • @norok2 slice output: a 2D image that predicted (yellow and purple points) and splitted images as you can see in the picture, Pack them back: 2D splitted image to 2D image (if you ignore white spaces in the picture, you can imagine what I want exactly.) optimal: Ignore this word. – vrd.gn Sep 12 '18 at 14:03
  • 2
    You mean something like `numpy.hstack()` / `numpy.vstack()`? – norok2 Sep 12 '18 at 14:05
  • @norok2 yeah, I have never used those commands. But, as I understand, it may work. I've started to search it. – vrd.gn Sep 12 '18 at 14:06
  • 1
    [Form a big 2d array from multiple smaller 2d arrays](https://stackoverflow.com/a/16873755/8069403), is this what you are looking for? – xdze2 Sep 12 '18 at 20:26
  • @xdze2 that looks helpful. Thank you, I will try to apply this method. – vrd.gn Sep 13 '18 at 09:32

0 Answers0