MCPcopy Create free account
hub / github.com/MITK/MITK / ComputeNumpyShape

Function ComputeNumpyShape

Wrapping/Python/mitk/Image.cpp:111–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111std::vector<py::ssize_t> ComputeNumpyShape(const Image& img)
112{
113 std::vector<py::ssize_t> shape;
114
115 for (unsigned int i = 0; i < img.GetDimension(); ++i)
116 shape.push_back(img.GetDimension(i));
117
118 if (img.GetPixelType().GetNumberOfComponents() > 1)
119 shape.push_back(img.GetPixelType().GetNumberOfComponents());
120
121 std::reverse(shape.begin(), shape.end());
122
123 return shape;
124}
125
126py::array BuildNumpyArray(const Image& img, const void* data, bool writeable, py::capsule capsule)
127{

Callers 2

BuildNumpyArrayFunction · 0.85
InitImageFunction · 0.85

Calls 5

GetNumberOfComponentsMethod · 0.80
GetDimensionMethod · 0.45
GetPixelTypeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected