diff --git a/2d_spots_in_fibers.py b/2d_spots_in_fibers.py index 181b435b77a3ed2b8d20e560606ed9e70364c2ac..f6ec4ba170b8adb9bd5a0dee240861af08a9592c 100644 --- a/2d_spots_in_fibers.py +++ b/2d_spots_in_fibers.py @@ -29,11 +29,6 @@ from loci.plugins.in import ImporterOptions from loci.formats import ImageReader, MetadataTools, Memoizer # MorpholibJ imports from inra.ijpb.binary import BinaryImages -# imglib2 imports -from net.imglib2.img.display.imagej import ImageJFunctions -from net.imglib2.roi import Regions -from net.imglib2.roi.labeling import LabelRegions -from net.imglib2.algorithm.labeling import ConnectedComponents # BIOP imports from ch.epfl.biop.ij2command import Labels2Rois, Rois2Labels # python imports @@ -288,32 +283,6 @@ def save_image_as_IJtif(imp, filename, suffix, target): IJ.saveAs(imp, "Tiff", savepath) -def convert_labelimage_to_imglib2regions(imp): - """Convert a ImagePlus label image to imglib2 regions - - Parameters - ---------- - imp : ImagePlus - the input label image - - Returns - ------- - Imglib2 LabelRegions - the imglib2 label regions - """ - - # fist convert ImagePlus to img as suggested by curtis: - # from https://forum.image.sc/t/how-to-wrap-any-kind-of-imageplus-to-an-imglib2-img-floattype/178/6 - wrapImg = ImageJFunctions.wrap(imp) - # workaround to convert a label image into an imglib2 ImgLabeling (which contains not only an image) - img_labeling = ops.labeling().cca(wrapImg, ConnectedComponents.StructuringElement.EIGHT_CONNECTED) - # img = img_labeling.getIndexImg() # the img label image - # ImageJFunctions.show(img) - regions = LabelRegions(img_labeling) - - return regions - - def convert_labelimage_to_binary(label_imp, scale_binary=True): """Convert a label image to a mask / binary image