[ImageJ-devel] imagej-ops : outputop-service branch

Jay Warrick jay.w.warrick at gmail.com
Thu Jun 25 02:11:42 CDT 2015


Hi Christian,

Turns out most of my problems were fixed with the latest updates to the imglib2-roi (0153fc8d2a566f74c65bc5f22d85fa8669f6f60b, 0.3.2-SNAPSHOT) which corrected a bounding box miscalculation. This error resulted in "polygons" with no points given the min and max bounds were the same. There also might be an opportunity to return NaN for such polygons instead of returning an error (i.e., when polygon.size()==1, which is actually 0 since the size() method returns the size of the internal point array + 1)... depends on what you think is best.

So the updated bounding box calcs fixed GeometricFeatureSet and Haralick2DFeatureSet errors.

I also created a pull request (https://github.com/imagej/imagej-ops/pull/150) for what I think might be a fix for the ZernikeComputer. When using Regions.sample(region, src) with the ZernikeFeatureSet instead of an Img<UnsignedByteType> as the test class does, the width and height of the region seem to be miscalculated. Let me know if the proposed fix seems reasonable.

Basically the only thing left then is the histogram features which still seems a bit funky.

Cheers!

Jay

> On Jun 13, 2015, at 9:18 PM, Jay Warrick <jay.w.warrick at gmail.com> wrote:
> 
> Thanks, Christian. Good to know I'm not necessarily doing anything too far off base. I'll keep an eye out for the PRs and try my code out again at those times. I'll also see if I can't separate my code out into something that resembles a test class and pass along when I can. 
> 
> Thanks for the reply. I'm excited and look forward to helping as I can. Keep up the good work.
> 
> Cheers,
> 
> Jay
> 
> 
> 
>> On Jun 13, 2015, at 1:52 PM, Christian Dietz <Christian.Dietz at uni-konstanz.de> wrote:
>> 
>> Hi Jay,
>> 
>> this is great feedback. Thank you. As you already mentioned in your
>> E-Mail, the API of the OpResolver, FeatureService etc is highly unstable
>> at the moment as the development still is on a topic-branch of
>> ImageJ-Ops (which is also in 0.x at the moment). However, I'm really
>> trying to get this stuff merged to master soon. Therefore, I will start
>> (and actually already started) a series of more atomar Pull-Requests on
>> ImageJ-Ops to get all the stuff merged. It would be amazing if you can
>> also have a look at the PRs and give some comments and feedback on the
>> individual functionality.
>> 
>> Please find more answers in-line. Again, thank you for your feedback!
>> Great that the stuff is used out there already ;-)
>> 
>> Christian
>> 
>> 
>> 
>> On Sa, 2015-06-13 at 03:29 -0500, Jay Warrick wrote: 
>>> Hi All,
>>> 
>>> 
>>> I chatted with Curtis Rueden a bit today about trying this
>>> developmental feature extraction stuff out. He said I should note any
>>> successes or challenges as it might help your progress. He suggested
>>> potentially to post on the pull request but it seemed a bit long for
>>> there.
>>> 
>>> 
>>> First of all, fantastic stuff. You are bringing so much quantitative
>>> power to the fingertips of a lot of individuals like myself. Thank
>>> you! Secondly, sorry if I'm using anything inappropriately in the
>>> rundown below but this is my best shot at trying to give you some
>>> feedback on my attempt to use your code. Also, I totally realize
>>> things are still in flux so I didn't necessarily have expectations
>>> that all this stuff would work immediately for me.
>>> 
>>> 
>>> As of what was synced to the imagej-ops : outputop-service branch
>>> tonight, I was able to successfully get measures from a
>>> `FirstOrderStatFeatureSet` for a set of `LabelRegion`s that I got from
>>> a `Img<UnsignedByteType>` using `ConnectedComponents` (from latest
>>> ImgLib2-algorithm SNAPSHOT but just temporarily copied to its own
>>> class local for this test) and apply them to an
>>> `Img<UnsignedShortType>` using `Regions.sample(myLabelRegion, myImg)`.
>> 
>> This is 100% correct. The new CCA should soon be part of the stable
>> imglib2-algorithms. We will also make it available in Ops as soon as it
>> was released with imglib2-algorithms. Thanks for tpietzsch for the
>> implementation!
>> 
>> Anyway, I'm working on several Ops will make your live easier when
>> trying to extract and loop over LabelRegions. 
>> 
>>> I think I did most of these tests using connected components detected
>>> using a 4-connected structuring element (if that matters at all).
>>> 
>>> 
>>> I ran into an issue with the `GeometricFeatureSet` where I got a 
>>> `````
>>> java.lang.ArrayIndexOutOfBoundsException: -1
>>> java.util.ArrayList.elementData(ArrayList.java:400)
>>> java.util.ArrayList.remove(ArrayList.java:477)
>>> net.imagej.ops.geometric.polygon.DefaultConvexHullOp.run(DefaultConvexHullOp.java:127)
>>> `````
>>> All my regions are quite sizeable (all between 1000 and 6000 pixels,
>>> see end of email) so I'm not sure why this would happen. I'm basically
>>> doing the following for this test using the same regions as I used
>>> with the `FirstOrderStatFeatureSet`
>>> 
>>> 
>>> `````
>>> GeometricFeatureSet opGeometric =
>>> ij.op().op(GeometricFeatureSet.class, LabelRegion.class);
>>> List<Pair<String, DoubleType>> results =
>>> opGeometric.getFeatureList(Regions.iterable(myLabelRegion));
>>> `````
>> 
>> The GeometricFeatureSet is really something we have to work on. Thanks
>> for the report. I also found some serious problems with the design of
>> several methods and I hope that I can fix it next week.
>> 
>>> 
>>> 
>>> I'm also having a problem with `Haralick2DFeatureSet` using those same
>>> `LabelRegion`s.
>>> `````
>>> java.lang.ArrayIndexOutOfBoundsException: -1
>>> net.imglib2.roi.labeling.LabelRegion.dimension(LabelRegion.java:459)
>>> net.imglib2.AbstractWrappedInterval.dimension(AbstractWrappedInterval.java:59)
>>> net.imagej.ops.features.haralick.helper.CooccurrenceMatrix2D.run(CooccurrenceMatrix2D.java:119)
>>> `````
>>> I'm testing the `Haralick2DFeatureSet` as follows...
>>> ````
>>> Haralick2DFeatureSet<UnsignedShortType> opHaralick2DHor =
>>> ij.op(Haralick2DFeatureSet.class,
>>> (IterableInterval<UnsignedShortType>) image, 8d, 1d, "HORIZONTAL");
>>> List<Pair<String, DoubleType>> results =
>>> opHaralick2DHor.getFeatureList(Regions.sample(myLabelRegion, image));
>>> `````
>> 
>> This is something we have to look into as soon as we file the Haralick
>> PR. I will turn your code into a test and make sure that it works.
>> 
>>> 
>>> The `HistogramFeatureSet` appears to work. I think I don't have my
>>> image adjusted right to see appropriate values in the histogram output
>>> though as I seem to get all 0's. I assumed the "number of bins"
>>> parameter would autoscale the data according to the image type (e.g.,
>>> UnsignedShortType image scaled to fit in 256 levels/bins) but I can
>>> see why that was likely a bad assumption.
>> 
>> This should actually happen. I will double-check. Again, as soon as we
>> file the "HistogramFeature" PR, it would be great if you could test
>> again. 
>>> 
>>> 
>>> The `ImageMomentsFeatureSet` seems to work fine.
>>> 
>>> 
>>> I got the following error trying to use the `Zernike` feature set...
>>> `````
>>> java.lang.NumberFormatException
>>> java.math.BigDecimal.<init>(BigDecimal.java:470)
>>> java.math.BigDecimal.<init>(BigDecimal.java:739)
>>> java.math.BigDecimal.valueOf(BigDecimal.java:1069)
>>> net.imagej.types.BigComplex.setReal(BigComplex.java:225)
>>> net.imagej.ops.features.zernike.ZernikeComputer.normalize(ZernikeComputer.java:193)
>>> net.imagej.ops.features.zernike.ZernikeComputer.fastZernikeComputation(ZernikeComputer.java:151)
>>> `````
>>> I'm using it as follows on the 8-bit mask image
>>> `````
>>> ZernikeFeatureSet<UnsignedByteType> opZernike =
>>> ij.op().op(ZernikeFeatureSet.class,
>>> (IterableInterval<UnsignedByteType>) mask, true, true, 1, 3);
>>> List<Pair<String, DoubleType>> results =
>>> opZernike.getFeatureList(Regions.sample(myLabelRegion, mask));
>>> `````
>> 
>> I will forward it to the implementor of Zernike. Seems that there are
>> some tests missing.
>> 
>>> 
>>> I figured, in case I'm doing a bunch of things wrong, it would be
>>> easier for you to just have the data I'm using to see if you get the
>>> same issues using your own code. The images that I'm using are here...
>>> 
>>> 
>>> https://drive.google.com/folderview?id=0BzopfqjGpdu8flBNTHdjXzN2eUJhR1NCNmNTbHJ5T3RNVDJRbmdwVnJiYnI0Nk43ZXp3QzA&usp=sharing
>>> 
>>> 
>>> The folder includes a small txt output of only the label regions that
>>> I'm analyzing (their pixel areas and centers of mass), given I am not
>>> using all labeled objects that come from the connected components
>>> analysis. Lastly, my label indices start at 0 if you are looking to
>>> match up output from ConnectedComponents with this.
>>> 
>>> 
>>> If you have any feedback on where I might be doing things wrong,
>>> please let me know.
>>> 
>> 
>> Thanks for the data. We will also soon have a Image Segment Feature Node
>> within KNIME and also use the KNIME testing system to find the last(...)
>> bugs. Maybe this node can also help you extracting features for your
>> data!
>> 
>>> 
>>> Thanks!
>>> 
>>> 
>>> Jay
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> ImageJ-devel mailing list
>>> ImageJ-devel at imagej.net
>>> http://imagej.net/mailman/listinfo/imagej-devel
>> 
>> 
>> 
>> _______________________________________________
>> ImageJ-devel mailing list
>> ImageJ-devel at imagej.net
>> http://imagej.net/mailman/listinfo/imagej-devel
> 
> 
> _______________________________________________
> ImageJ-devel mailing list
> ImageJ-devel at imagej.net
> http://imagej.net/mailman/listinfo/imagej-devel




More information about the ImageJ-devel mailing list