Hi, I don't know exactly why you can't do this. The actual work happens in this helper <http://www.pyqtgraph.org/documentation/_modules/pyqtgraph/functions.html#affineSlice> function, but it looks at first glance like it should handle any order of axes tuple. The question is then what is array is being indexed to create that error, and if it is supposed to have three dimensions, why is one of them going missing?
As a workaround, could you transpose either the resulting slice, or the input? So something like: self.testroi.getArrayRegion(self.dataset1.transpose((0,2,1)), self.imvOCTTopLeft.getImageItem(), axes=(1,2), returnMappedCoords=True) or self.testroi.getArrayRegion(self.dataset1, self.imvOCTTopLeft.getImageItem(), axes=(1,2), returnMappedCoords=True).T Patrick On Tuesday, 7 May 2019 19:15:26 UTC+9:30, [email protected] wrote: > > I am trying to use a LineSegment ROI to extract a 2D slice from a 3D > image. > There are three axis' in the provided dataset, 0, 1, and 2. > > A 2D image is displayed using x:2, y:1, and t:0 with a slider connected to > t, allowing the user to move through the depth of the image. > > A line segment ROI is imposed over this 2D image, and I am trying to > extract a 2D slice from the image representing a cross section of the > displayed 2D image. > > The problem I am having is in the following line... > > self.testroi.getArrayRegion(self.dataset1, self.imvOCTTopLeft.getImageItem(), > axes=(1,2), returnMappedCoords=True) > > > At the moment this code is successfully producing a cross sectional image, > however it is > > retrieving the axis values from the image incorrectly. Ideally, I should be > able to set > > axes=(2,1), however when I try to do this I am getting the following error: > > > > "numpy.AxisError: axis 2 is out of bounds for array of dimension 2" > > > If both axis 2 and 1 exist in the dataset and are accessible in the > axes=(1,2) format, why should they not be > > accessible in axes=(2,1) format? > > -- You received this message because you are subscribed to the Google Groups "pyqtgraph" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pyqtgraph/c9afca6a-0d6e-44b3-a468-06bfe52ee4cf%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
