Hi all,
Suppose I have a hyperstack with 200 time points, each time point having 30 sections. How can I cut out a sub-hyperstack of only 10 time points, each time point with 30 sections? For some reason, the "Duplicate" command doesn't offer a range of time points to preserve. It would be great if the "Duplicate" dialog contained a range for time and a range for Z as well. (Of course all the above can be done trivially with a script, but I am aiming at a point-and-click solution). Thanks for any info. Albert -- http://albert.rierol.net |
Hi Albert,
instead of modifying the "Duplicate" dialog it would be also possible to modify the existing the "HyperStackReducer". Currently it does not allow setting a range neither in z nor time. Regards Arne -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Albert Cardona Sent: vendredi 8 octobre 2010 11:46 To: [hidden email] Subject: how to obtain a sub-hyperstack? Hi all, Suppose I have a hyperstack with 200 time points, each time point having 30 sections. How can I cut out a sub-hyperstack of only 10 time points, each time point with 30 sections? For some reason, the "Duplicate" command doesn't offer a range of time points to preserve. It would be great if the "Duplicate" dialog contained a range for time and a range for Z as well. (Of course all the above can be done trivially with a script, but I am aiming at a point-and-click solution). Thanks for any info. Albert -- http://albert.rierol.net |
In reply to this post by Albert Cardona-2
Hi Albert,
is the following Plugin doing what you were aiming at? Cheers Arne /*Copyright (c) 2010 Arne Seitz"*/ import ij.IJ; import ij.ImagePlus; import ij.ImageStack; import ij.WindowManager; import ij.gui.GenericDialog; import ij.plugin.PlugIn; public class StackReducer_ implements PlugIn { int subchannel=1,startframe=1,endframe=1; int startslice=1; int endslice=1; public void run(String arg) { ImagePlus imp=WindowManager.getCurrentImage(); if (imp==null){ IJ.showMessage("An image stack is needed"); return; } GenericDialog gd = new GenericDialog("Subvolume Opener"); startslice=(imp.getNSlices()/2)-1; endslice=(imp.getNSlices()/2)+1; gd.addMessage(""); if (imp.getNChannels()>1){ gd.addMessage(imp.getNChannels()+" Channels"); gd.addNumericField("Channel", 1,0); } if (imp.getNSlices()>1) { gd.addMessage(imp.getNSlices()+" Z-Slices"); gd.addNumericField("Start Slice", startslice,0); gd.addNumericField("End Slice", endslice, 0); } if (imp.getNFrames()>1){ gd.addMessage(imp.getNFrames()+" time frames"); gd.addNumericField("Start time-frame",1,0); gd.addNumericField("End time-frame",imp.getNFrames(),0); } gd.showDialog(); if (gd.wasCanceled()) { return; } if (imp.getNChannels()>1){ subchannel=(int)gd.getNextNumber(); if (subchannel>imp.getNChannels())subchannel=imp.getNChannels(); if (subchannel<1)subchannel=1; } if (imp.getNSlices()>1) { startslice=(int)gd.getNextNumber(); if (startslice>imp.getNSlices())startslice=imp.getNSlices(); if (startslice<1)startslice=1; endslice=(int)gd.getNextNumber(); if (endslice>imp.getNSlices())endslice=imp.getNSlices(); if (endslice<1)endslice=1; if (endslice<startslice)endslice=startslice; } if (imp.getNFrames()>1){ startframe=(int)gd.getNextNumber(); if (startframe<1)startframe=1; endframe=(int)gd.getNextNumber(); if (endframe>imp.getNFrames())endframe=imp.getNFrames(); } ImageStack newStack= new ImageStack(imp.getWidth(),imp.getHeight()); for (int slice=startslice;slice<endslice;++slice){ for (int frame=startframe;frame<endframe;++frame){ imp.setPositionWithoutUpdate(subchannel, slice, frame); newStack.addSlice("slice"+slice+" frame"+frame, imp.getProcessor()); } } ImagePlus newimp= new ImagePlus("New stack",newStack); newimp.setOpenAsHyperStack(true); newimp.setDimensions(1, endslice-startslice, endframe-startframe); newimp.show(); } } -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Albert Cardona Sent: vendredi 8 octobre 2010 11:46 To: [hidden email] Subject: how to obtain a sub-hyperstack? Hi all, Suppose I have a hyperstack with 200 time points, each time point having 30 sections. How can I cut out a sub-hyperstack of only 10 time points, each time point with 30 sections? For some reason, the "Duplicate" command doesn't offer a range of time points to preserve. It would be great if the "Duplicate" dialog contained a range for time and a range for Z as well. (Of course all the above can be done trivially with a script, but I am aiming at a point-and-click solution). Thanks for any info. Albert -- http://albert.rierol.net |
Arne,
Thanks for the input and the plugin. My point is that being such feature already built-in for regular stacks, it is only expected that hyperstacks would not have to be handled specially. Therefore the "Duplicate" command could be extended to offer the right options for time and depth. If someone doesn't do it before, I'll hack it this weekend. Best, Albert -- http://albert.rierol.net |
I am interested in performing a similar task on hyperstacks as you Albert
and a few days ago I even checked the duplicate command thinking it would do the job, but alas, it did not. I will check that plugin from Arne. A built in function would be great though. Mike -------------------------------------------------- From: "Albert Cardona" <[hidden email]> Sent: Friday, October 08, 2010 2:53 PM To: <[hidden email]> Subject: Re: how to obtain a sub-hyperstack? > Arne, > > Thanks for the input and the plugin. My point is that being such > feature already built-in for regular stacks, it is only expected that > hyperstacks would not have to be handled specially. Therefore the > "Duplicate" command could be extended to offer the right options for > time and depth. If someone doesn't do it before, I'll hack it this > weekend. > > Best, > > Albert > -- > http://albert.rierol.net > > > __________ Information from ESET Smart Security, version of virus > signature database 5515 (20101008) __________ > > The message was checked by ESET Smart Security. > > http://www.eset.com > > > __________ Information from ESET Smart Security, version of virus signature database 5515 (20101008) __________ The message was checked by ESET Smart Security. http://www.eset.com |
In reply to this post by Albert Cardona-2
On Oct 8, 2010, at 5:45 AM, Albert Cardona wrote:
> Hi all, > > Suppose I have a hyperstack with 200 time points, each time point > having 30 sections. > > How can I cut out a sub-hyperstack of only 10 time points, each time > point with 30 sections? > > For some reason, the "Duplicate" command doesn't offer a range of time > points to preserve. > > It would be great if the "Duplicate" dialog contained a range for time > and a range for Z as well. > > (Of course all the above can be done trivially with a script, but I am > aiming at a point-and-click solution). You will be able to do this using the Image>Duplicate command in the ImageJ 1.44j1 daily build, which will be available tonight. -wayne |
Brilliant, thanks Wayne ! It will be a very useful addition.
Mike -------------------------------------------------- From: "Rasband, Wayne (NIH/NIMH) [E]" <[hidden email]> Sent: Friday, October 08, 2010 4:21 PM To: <[hidden email]> Subject: Re: how to obtain a sub-hyperstack? > On Oct 8, 2010, at 5:45 AM, Albert Cardona wrote: > >> Hi all, >> >> Suppose I have a hyperstack with 200 time points, each time point >> having 30 sections. >> >> How can I cut out a sub-hyperstack of only 10 time points, each time >> point with 30 sections? >> >> For some reason, the "Duplicate" command doesn't offer a range of time >> points to preserve. >> >> It would be great if the "Duplicate" dialog contained a range for time >> and a range for Z as well. >> >> (Of course all the above can be done trivially with a script, but I am >> aiming at a point-and-click solution). > > You will be able to do this using the Image>Duplicate command in the > ImageJ 1.44j1 daily build, which will be available tonight. > > -wayne > > > __________ Information from ESET Smart Security, version of virus > signature database 5515 (20101008) __________ > > The message was checked by ESET Smart Security. > > http://www.eset.com > > > __________ Information from ESET Smart Security, version of virus signature database 5515 (20101008) __________ The message was checked by ESET Smart Security. http://www.eset.com |
Free forum by Nabble | Edit this page |