Hi,
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 Kevin Clark |
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 |
Excellent Thanks, I'll give it a try. Plus I was unaware of Fiji until now.
Checking it out. Thanks KEvin On Wed, Mar 3, 2010 at 10:24 AM, Johannes Schindelin < [hidden email]> wrote: > 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 > > |
Hi Kevin. I had a similar need a couple years ago and someone on the
ImageJ list helped me put together a small macro that does what you described you wanted it to do: a=0; n=getNumber("Frame reduction ratio (1/n)", 5); for (i=1;i<=nSlices;) { run("Set Slice...", "slice="+i); if(a!=0) run("Delete Slice"); else i++; a++; if(a==n) a=0; } John Oreopoulos On 3-Mar-10, at 1:23 PM, Kevin Clark wrote: > Excellent Thanks, I'll give it a try. Plus I was unaware of Fiji > until now. > Checking it out. > > Thanks > > KEvin > > On Wed, Mar 3, 2010 at 10:24 AM, Johannes Schindelin < > [hidden email]> wrote: > >> 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 >> >> |
Here is substack maker that will do what you what (except sort of
backwards) Phil Substack Maker Author: Anthony Padua (padua001 at mc.duke.edu) Daniel Barboriak, MD (barbo013 at mc.duke.edu) Neuroradiology Duke University Medical Center History: 2003/06/26: First version 2004/12/10: Calibration is carried over to the substack 2005/11/02: Macro recordable Requires: ImageJ 1.30m or newer Source: Substack_Maker.java Installation: Download Substack_Maker.class to the plugins folder and restart ImageJ. Description: The purpose of this plugin is to extract selected images from a stack to make a new substack. It would take one of two types of input: either a range of images (e.g. 2-14) or a list of images (e.g. 7,9,25,27,34,132) and copy those images from the active stack to a new stack in the order of listing or ranging. On Mar 3, 2010, at 11:57 AM, John Oreopoulos wrote: > Hi Kevin. I had a similar need a couple years ago and someone on the > ImageJ list helped me put together a small macro that does what you > described you wanted it to do: > > a=0; > n=getNumber("Frame reduction ratio (1/n)", 5); > for (i=1;i<=nSlices;) > { > run("Set Slice...", "slice="+i); > if(a!=0) > run("Delete Slice"); > else > i++; > a++; > if(a==n) > a=0; > } > > John Oreopoulos > > > On 3-Mar-10, at 1:23 PM, Kevin Clark wrote: > >> Excellent Thanks, I'll give it a try. Plus I was unaware of Fiji >> until now. >> Checking it out. >> >> Thanks >> >> KEvin >> >> On Wed, Mar 3, 2010 at 10:24 AM, Johannes Schindelin < >> [hidden email]> wrote: >> >>> 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 >>> >>> |
Free forum by Nabble | Edit this page |