imglib / imglib2-roi

Regions of interest (ROIs) and labelings for ImgLib2
Other
8 stars 8 forks source link

Create LabelingType of different label type #7

Closed dietzc closed 9 years ago

dietzc commented 9 years ago

@tpietzsch another one:

to create a LabelingType<L> I usually use the underlying RandomAccessibleInterval<LabelingType<L>> and create another variable from the first element. However, assume you want to create a LabelingType<V>. There is no way to create an empty LabelingType<V> without having another LabelingType<V> at hand. Could we add a helper method for that to LabelingType?

static <V> createLabelingType(final Class<V> v){ ... }?

Use-case: Read-only converters.

tpietzsch commented 9 years ago

@dietzc Sounds good. You could add it to net.imglib2.roi.util.Util

dietzc commented 9 years ago

@tpietzsch how would I do it outside the LabelingType?

tpietzsch commented 9 years ago

right, the constructor is protected... yes, then in the LabelingType

dietzc commented 9 years ago

I will make a PR.

ctrueden commented 9 years ago

I know I am super anal about this, but can we consider renaming the class called Util? I really like how ImgLib2 (and core Java e.g. Arrays) name some utility classes with plurals. We could have a utility class called ROIs.

tpietzsch commented 9 years ago

@ctrueden Sure, lets rename it! How about RoiUtils? I would like to reserve Regions for the Views-like static methods and ROIs maybe comes confusingly close.

ctrueden commented 9 years ago

@tpietzsch OK, how about ROIUtils then? The SciJava naming convention is to avoid camel-casing acronyms, but instead keep them up-case. Though if you want to establish a different convention for ImgLib2 naming in general, I am OK with that, as long as it's consistent.

tpietzsch commented 9 years ago

@ctrueden I have no strong preference. ROIUtils is fine.