Skip to content

Commit

Permalink
fixed the 255 labels limit
Browse files Browse the repository at this point in the history
  • Loading branch information
volker-baecker committed Nov 13, 2024
1 parent 77be61a commit dfc81cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion volker/toolsets/spine_analyzer/segment_spine.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def main():
if spineChannel and currentC == spineChannel:
IJ.error("Please run the segmentation on a greyscale channel!")
sys.exit()
roi = inputImage.getRoi();
roi = inputImage.getRoi()
if not roi:
IJ.error("Please draw a ROI around a spine!")
sys.exit()
Expand Down
6 changes: 6 additions & 0 deletions volker/toolsets/spine_analyzer/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from ij.process import LUT
from ij.process import ImageStatistics
from ij.process import StackStatistics
from ij.process import ImageConverter
from fr.cnrs.mri.cialib.stackutil import HyperstackUtils
from inra.ijpb.binary import BinaryImages
from inra.ijpb.label import LabelImages
Expand Down Expand Up @@ -140,6 +141,11 @@ def getMaxLabel(self):
def addFromMask(self, mask, startSlice=None, endSlice=None):
"""Add the biggest connected object in the mask as a an object to the segmentation with the next unused label.
"""
doScaling = ImageConverter.getDoScaling()
ImageConverter.setDoScaling(False)
imageConverter = ImageConverter(mask)
imageConverter.convertToGray16()
ImageConverter.setDoScaling(doScaling)
LabelImages.replaceLabels(mask, [255], self.nextLabel)
HyperstackUtils.copyStackTo(self.image, mask, self.labelChannelIndex, self.image.getT(), lut=self.lut, startSlice=startSlice, endSlice=endSlice)
self.nextLabel = self.nextLabel + 1
Expand Down

0 comments on commit dfc81cc

Please sign in to comment.