Re: Remove Blocks of Slices from Stack
Posted by dscho on Mar 03, 2010; 6:24pm
URL: http://imagej.273.s1.nabble.com/Remove-Blocks-of-Slices-from-Stack-tp3689145p3689146.html
Hi,
On Wed, 3 Mar 2010, kev0153 wrote:
> I have a stack of 1000 slices. I would like to remove a block of 6
> slices. For example Slice 1 keep, slice 1-6 remove, slice 8 keep, slice
> 8-14 remove, slice 15 keep etc..
>
> I could do this by hand but with 1000 slices it would take awhile. I
> don't really know java so any help would be appreciated thanks
If you are using Fiji, you can use Image>Stacks>Manipulation>Substack
Maker. Otherwise, you might want to run a macro like this:
Dialog.create("Delete slice range");
Dialog.addNumber("first_slice", 1);
Dialog.addNumber("last_slice", 1);
Dialog.show();
first = Dialog.getNumber();
count = Dialog.getNumber() + 1 - first;
setSlice(first);
for (i = 0; i < count; i++)
run("Delete Slice");
(Note: this is completely untested, so you might need to fix a typo or
two.)
This macro only allows deleting one consecutive slice range, though, so
you have to start it 6 times.
Ciao,
Johannes