Login  Register

how to update ImagePlus in Python

Posted by Aryeh Weiss on Feb 25, 2015; 3:40pm
URL: http://imagej.273.s1.nabble.com/how-to-update-ImagePlus-in-Python-tp5011768.html

I have an  ImagePlus that was created by loading a stack from a file.
I am trying to remove a single slice as follows:

# this stack has 6 slices
inputStack = impInput.getImageStack()
inputStack.deleteSlice(6)

impInput.show()

print impInput.getNChannels()
# this command now prints 5

dupStack = inputStack.duplicate()
impTest = ImagePlus("lksdfj", dupStack)
impTest.show()

The original image (impInput), appears with on slice missing (as
expected, but it is the wrong slice, and the information overthe image
is not completely correct (it shows 5 slices, but still thins it has 6
channels).

The duplicated stack (dupStack) was used to create a new imp (impText).
This image is shown correctly, with the correct slice removed.
However, it still says c:5/6 over the image..

What is the correct way to manipulate an ImageStack, and then update the
ImagePlus and ImageProcessr?

I looked in the tutorials (which are very nice), but the examples I
found had the stacks being built "fresh". My confusion is how to deal
with an existing imp. I suppose I could create a new imp each time I do
something, but that does not seem to be the right way.

Thanks in advance.
--aryeh

--
Aryeh Weiss
Faculty of Engineering
Bar Ilan University
Ramat Gan 52900 Israel

Ph:  972-3-5317638
FAX: 972-3-7384051

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html