Skip to content
Snippets Groups Projects
Commit b0af8759 authored by Kai Schleicher's avatar Kai Schleicher
Browse files

Remove unused function and imports

parent e3e5ee76
No related branches found
No related tags found
1 merge request!2Initial commit
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment