Skip to content

Commit

Permalink
display adjustment and auto-increment
Browse files Browse the repository at this point in the history
  • Loading branch information
volker-baecker committed Jan 25, 2024
1 parent 5b75a4d commit 5d75614
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion volker/toolsets/spine_analyzer/replace_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def main():
spineChannel = segmentation.getLabelChannelIndex()
segmentation.replaceLabel(X, Y, Z, FRAME, NEW_LABEL)
image.setC(spineChannel)
image.setDisplayRange(0, 255)
image.resetDisplayRange()
image.setC(originalC)
image.updateAndDraw()

Expand Down
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 @@ -92,7 +92,7 @@ def main():
else:
segmentation.addFromAutoThresholdInRoi(roi, threshold=threshold)
inputImage.setC(spineChannel)
inputImage.setDisplayRange(0, 255)
inputImage.resetDisplayRange()
inputImage.setC(originalC)
inputImage.updateAndDraw()

Expand Down
1 change: 0 additions & 1 deletion volker/toolsets/spine_analyzer/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def __init__(self, image, nextLabel=0):
"""Create a new instance segmentation for the given image. If the image already has a label-channel it is used for the
instance segmentation, otherwise an empty label-channel is added to the image.
"""
ImagePlus.setDefault16bitRange(15) # 15 avoids reset when auto-adjust is called on other channels
self.maxDistance = self.MAX_DISTANCE
self.setLUT(self.DEFAULT_LUT_NAME)
self.setThresholdingMethod(self.DEFAULT_THRESHOLDING_METHOD)
Expand Down
6 changes: 0 additions & 6 deletions volker/toolsets/spine_analyzer/stackutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ def copyStackTo(image, stack, channel, frame, lut=None, overwrite=False, startSl
if not rangeEnd:
rangeEnd = stack.getStack().size()
stackSliceNumber = 1
print("rangeStart", rangeStart)
print("rangeEnd", rangeEnd)
for sliceNumber in range(rangeStart, rangeEnd + 1):
print("sliceNumber", sliceNumber)
print("stackSliceNumber", stackSliceNumber)
image.getStack().getProcessor(offset + ((sliceNumber-1) * nChannels)).copyBits(stack.getStack().getProcessor(stackSliceNumber), 0, 0, pasteMethod)
stackSliceNumber = stackSliceNumber + 1
image.setC(channel)
Expand Down Expand Up @@ -107,11 +103,9 @@ def segmentObjectInRegion(image, roi, method="Default", firstZ=None, lastZ=None,
processor = maskImage.getStack().getProcessor(z)
processor.fillOutside(roi)
if threshold:
print("using threshold value: ", threshold)
IJ.setRawThreshold(maskImage, threshold, 65535)
IJ.run(maskImage, "Convert to Mask", "background=Dark Black")
else:
print("using auto-threshold mathod:", method)
IJ.setAutoThreshold(maskImage, method + " dark stack");
IJ.run(maskImage, "Convert to Mask", "method="+method+" background=Dark black")
labelsImage = LabelImages.regionComponentsLabeling(maskImage, 255, 6, 32)
Expand Down

0 comments on commit 5d75614

Please sign in to comment.