I often work with stacks and want to access the Z-axis Profile from scripts. There is the ZAxisProfiler plugin that offers some public methods, but you can’t pass an ImagePlus to create the profile from (instead
imp = IJ.getImage() is used in
run()) and it needs some wrangling to get the profile data.
I want to implement a z-axis Profiler that can be used in script. Therefore I need your hint on how to do this. This are three possible destinations I can choose from:
- Modifying the ZAxisProfiler would be the easiest solution.
- Added by Wayne, see 4th entry of this topic.
- I could write new code (Plugin, Command or op) to get the Z-axis Profile
- Is there an easy way to reduce a full data set to a profile (e.g. first crop in the x-y plane and than reduce the x-y plane to a single value)?
For the last point I started a small Jython script that crops a stack (I used the t1-head sample), but not yet reduces the cropped x-y plane to a single value. Maybe one can combine such sequence of ops to a new op.
# @Dataset data # @OpService ops # @OUTPUT ImgPlus cropped from net.imglib2.util import Intervals from net.imagej.axis import Axes # first take a look at the size and type of each dimension for d in range(data.numDimensions()): print "axis d: type: "+str(data.axis(d).type())+" length: "+str(data.dimension(d)) img=data.getImgPlus() xLen = data.dimension(data.dimensionIndex(Axes.X)) yLen = data.dimension(data.dimensionIndex(Axes.Y)) zLen = data.dimension(data.dimensionIndex(Axes.Z)) print xLen, yLen, zLen cropped=ops.transform().crop(img, Intervals.createMinMax(128, 128, 0, 191, 191, zLen-1))