[ImageJ-devel] Python script: z projection

Hadrien Mary hadrien.mary at gmail.com
Sat Jan 24 16:29:05 CST 2015


I tried another approach without success neither :

-----------------------------------
# @DatasetService data
# @DisplayService display
# @ImageJ ij

from net.imagej.ops.statistics import Max
from net.imagej.ops.statistics import Sum
from net.imglib2.type.numeric import RealType

from jarray import array

fname = "/home/hadim/test_small.ome.tif"
ds = data.open(fname)

# TODO : find dimensions in ds object
dims = array([136, 65], 'l')
out = ij.op().createimg(dims)

# Find ndim for project on Z axis
ndim = 2

op = ij.op().sum(RealType, out)
ds2 = ij.op().project(out, ds, op, ndim)

ij.ui().show(ds2.getName(), ds2)

# TODO: should I delete out ?
-------------------------------------

--
Hadrien Mary

Ph.D student in Biology
Tournier-Gachet Team
CNRS - LBCMCP - UMR 5088

Université de Toulouse - Bât. 4R3B1
118, route de Narbonne - 31062 Toulouse


On Sat, Jan 24, 2015 at 9:35 PM, Hadrien Mary <hadrien.mary at gmail.com> wrote:
> Last thing : I would like to run this script in headless mode on
> pretty big images (17GB), so I would like to be sure wether `img =
> data.open(fname)` use SCIFIO to open them.
>
> If it does I guess virtual stack is used in case the opened image is
> big. Am I correct ?
>
> --
> Hadrien Mary
>
> Ph.D student in Biology
> Tournier-Gachet Team
> CNRS - LBCMCP - UMR 5088
>
> Université de Toulouse - Bât. 4R3B1
> 118, route de Narbonne - 31062 Toulouse
>
>
> On Sat, Jan 24, 2015 at 9:25 PM, Hadrien Mary <hadrien.mary at gmail.com> wrote:
>> Hi,
>>
>> I am trying to write a small script to perform z projection on an
>> image. It seems that I use the wrong signature for ops.project()
>> function. I tried many combinations without success...
>>
>> -------------------------------
>> # @DatasetService data
>> # @DisplayService display
>> # @OpService ops
>>
>> from net.imagej.ops.statistics import Max
>> from net.imglib2.type.numeric import RealType
>>
>> fname = "/home/hadim/test_small.ome.tif"
>> img = data.open(fname)
>> display.createDisplay(img.getName(), img)
>>
>> #op = ops.sum(RealType, img)
>> img2 = ops.project(img, Max, 1)
>> display.createDisplay(img2.getName(), img2)
>>
>> data.save(img2, "/home/hadim/projected.ome.tif")
>> -----------------------------------
>>
>> I looked the doc, imagej-ops tests but I can't find the correct
>> signature for python. Maybe you can help.
>>
>> Thank you
>>
>> --
>> Hadrien Mary
>>
>> Ph.D student in Biology
>> Tournier-Gachet Team
>> CNRS - LBCMCP - UMR 5088
>>
>> Université de Toulouse - Bât. 4R3B1
>> 118, route de Narbonne - 31062 Toulouse



More information about the ImageJ-devel mailing list