imagej / imagej-ops

ImageJ Ops: "Write once, run anywhere" image processing
https://imagej.net/libs/imagej-ops
BSD 2-Clause "Simplified" License
89 stars 42 forks source link

Quesrtion: Sobel filter #626

Closed ctr26 closed 4 years ago

ctr26 commented 4 years ago

This is a crosspost at the imagej forum:

How would run a (2D) sobel filter through a 3D volume slice wise using imagej ops?

The following code works for a DOG slice wise filter (I think, borrowed from an example) ,but switching in the sobel filter causes an error. I’m pretty sure using ops.filter().sobel(img) produces an n-dimensional sobel filter?


#@ Dataset data
#@OUTPUT Dataset output
#@ OpService ops
#@ DatasetService ds

from net.imagej.axis import Axes
converted = ops.convert().float32(data.getImgPlus())

dog = ops.create().img(converted)

converted_in = ops.transform().flatIterableView(converted)
converted_out = ops.transform().flatIterableView(dog)

dog_op = ops.op("filter.dog", converted_in,1,1)
#dog_op = ops.op("filter.sobel", converted_in)

t_dim = data.dimensionIndex(Axes.TIME)
fixed_axis = [d for d in range(0, data.numDimensions()) if d != t_dim]

ops.slice(converted_out,converted_in, dog_op, fixed_axis)

output = ds.create(converted_out)
imagejan commented 4 years ago

You asked the same question on the forum. Please always disclose when cross-posting, to avoid that people waste their time in replying with redundant information, and to enable others having a similar issue to follow the discussion.

As this is mostly a usage question rather than an issue with imagej-ops, let's continue the discussion on the forum.

ctr26 commented 4 years ago

You asked the same question on the forum. Please always disclose when cross-posting, to avoid that people waste their time in replying with redundant information, and to enable others having a similar issue to follow the discussion.

As this is mostly a usage question rather than an issue with imagej-ops, let's continue the discussion on the forum.

Apologies, I've updated my post

gselzer commented 4 years ago

Check out #627 for relevant conversation