-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scikit compatible axis format for crop() #142
Comments
Hi @nikofleischer , thanks for the feedback! I'm not sure if I understand. What is the difference between scikit compatibel stacks and np format? Aren't both numpy arrays? Feel free to share a code example (notebook?) wher the issue is visualized. It might then be easier to understand. Also if you can tell from which stackview version you upgraded to which version, this information might be helpful to identify the issue. Thanks! Best, |
Hi Robert, sorry my terminology got a bit rusty. Funny I land on a question of your's in the image.sc board when trying to find my words back. Stackview version was 0.7.6 I load multichannel .tiffs from fiji via io.imread, this places the channel axis in front [C,X,Y]. I then move the channels last using np.moveaxis[img,0,-1] to [X,Y,C] before doing some transformations and serving back the image. I could then load the image in the stackview.crop function with crop(img,axis = -1) and it would correctly display x,y and channels as z. When I do this now, it doesn't seem to be working anymore, instead I just get a vertical bar, as the C axis is interpreted as X axis. Just reloaded the old environment and confirmed, that the behaviour is different. But Ultimately I am lost on why I even did this. Sorry I am not a regular python user, I just know I switched the channel axis position for compatibility with another image processing package (maybe napari?) and I remember researching this because It striked me as odd that one package would use cxy and another xyc. But I can't retrace anymore what the exact reason was for this, so maybe this is not important and I should just use CXY format throughout the project. |
Hm, ok, I presume the relevant change might be RGB-image support since stackview 0.7.7 or support for n-data which was introduced in stackview 0.10.0 . Anyway, sckit-image typically handles RGB images as YXC dimension order and stackview supports cropping RGB images as shown here: So yes, converting your image from CXY dimension order to YXC makes sense. Let me know if there are open questions! |
Yes. RGB is 3 channels, and RGBA is 4 channels. |
Hi,
Thanks for the great little helper that is StackView!
I used it before in a project, and it helped greatly with many small things. I returned to the project and set up a fresh environment, probably updating StackView for a few versions. Before I could load scikit compatible stacks with the channels axis in last place by specifying axis = -1 in the call to crop. this doesn't seem to work anymore, and when loading a stack with X x Y x C I only get a small line instead of a full picture. If I change the image back to np format with the channels axis in first place, the stack displays fine. Is there a new way to work on scikit format image arrays with the stackview functions without having to convert the stack object back and forth?
Best and thanks a lot, Niko
The text was updated successfully, but these errors were encountered: