Issue
How do I reshape multiple 3-dimensional datacubes and 2-dimensional data labels into a single datacube and data label, in numpy?
Here is the iterate over the data set, my following code here please find it here -
# Example: Iterate over data set
for sample in dataset:
datacube, labelmap = sample
print(datacube.shape, labelmap.shape)
And the output looks like -
(389, 624, 23) (389, 624)
(389, 624, 23) (389, 624)
.
.
.
.
The question is how to reshape such a datacube which is 3 dimensions and a data label which is 2 dimensions in a single datacube and data label.
The two shapes would then have a size of (5 * 389 * 624, 15) for datacube and have a size of (5 * 389* 624) for label map.
Solution
datacube_stacked, labelmap_stacked = np.stack([datacube1,datacube2]) , np.stack([labelmap1, labelmap2])
Answered By - YScharf
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.