ValueError: Unable to convert array of size 30470400 to form (50,1104,104)

I am trying to run thrown this tutorial http://emmanuelle.github.io/segmentation-of-3-d-tomography-images-with-python-and-scikit-image.html

where I want to do 3D Tomographic Image Segmentation with Python.

I'm scared right at the beginning, with the image change.

This is the code:

%matplotlib inline

import numpy as np

import matplotlib.pyplot as plt 

import time as time 

data = np.fromfile('/data/data_l67/dalladas/Python3/Daten/Al8Cu_1000_g13_t4_200_250.vol', dtype=np.float32)

data.shape

(60940800,)

data.reshape((50,1104,104))

      

----------------------------------------------- --- ------------------------- ValueError Traceback (last call last) in () ----> 1 data.reshape ((50,1104, 104))

ValueError: Unable to convert array of size 30470400 to form (50,1104,104)

Can anyone help me?

+3


source to share


3 answers


There seems to be a typo, as 1104*1104*50=60940800

you are trying to resize as well 50,1104,104

. It looks like you need to change 104 to 1104.



+6


source


data.reshape((50,1104,-1))

      



works for me

+3


source


In matrix terms, there are no elements that are always equal to the product of the number of rows and columns. Here this condition does not match

0


source







All Articles