Skip to content

Commit 5352903

Browse files
Merge pull request #167 from MannLabs/fix_165
fix some small bugs
2 parents 5c1fb71 + a1740a1 commit 5352903

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

src/scportrait/pipeline/featurization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ def _generate_column_names(
11611161
column_names = []
11621162

11631163
if n_masks == 1:
1164-
self.project._check_sdata_status()
1164+
self.project.get_project_status()
11651165

11661166
if self.project.nuc_seg_status:
11671167
mask_name = self.MASK_NAMES[0]

src/scportrait/pipeline/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,7 @@ def featurize(
11251125

11261126
# check that prerequisits are fullfilled to featurize cells
11271127
assert self.featurization_f is not None, "No featurization method defined."
1128-
assert not (
1128+
assert (
11291129
self.nuc_seg_status or self.cyto_seg_status
11301130
), "No nucleus or cytosol segmentation loaded. Please load a segmentation first."
11311131
assert self.extraction_status, "No single cell data extracted. Please extract single cell data first."

src/scportrait/pipeline/segmentation/workflows.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,15 +1477,15 @@ def cellpose_segmentation(self, input_image):
14771477
np.max(input_image) - np.min(input_image)
14781478
) # min max normalize to 0-1 range as cellpose expects this
14791479

1480-
masks, _, _, _ = model.eval(
1480+
masks = model.eval(
14811481
[input_image],
14821482
rescale=self.rescale,
14831483
normalize=self.normalize,
14841484
diameter=self.diameter,
14851485
flow_threshold=self.flow_threshold,
14861486
cellprob_threshold=self.cellprob_threshold,
14871487
channels=[1, 0],
1488-
)
1488+
)[0]
14891489
masks = np.array(masks) # convert to array
14901490

14911491
# ensure all edge classes are removed
@@ -1587,15 +1587,15 @@ def cellpose_segmentation(self, input_image):
15871587
np.max(input_image) - np.min(input_image)
15881588
) # min max normalize to 0-1 range as cellpose expects this
15891589

1590-
masks_nucleus, _, _, _ = model.eval(
1590+
masks_nucleus = model.eval(
15911591
[input_image],
15921592
rescale=self.rescale,
15931593
normalize=self.normalize,
15941594
diameter=self.diameter,
15951595
flow_threshold=self.flow_threshold,
15961596
cellprob_threshold=self.cellprob_threshold,
15971597
channels=[1, 0],
1598-
)
1598+
)[0]
15991599
masks_nucleus = np.array(masks_nucleus) # convert to array
16001600

16011601
# manually delete model and perform gc to free up memory on GPU
@@ -1610,15 +1610,15 @@ def cellpose_segmentation(self, input_image):
16101610

16111611
model = self._load_model(model_type="cytosol", gpu=self.use_GPU, device=self.device)
16121612

1613-
masks_cytosol, _, _, _ = model.eval(
1613+
masks_cytosol = model.eval(
16141614
[input_image],
16151615
rescale=self.rescale,
16161616
normalize=self.normalize,
16171617
diameter=self.diameter,
16181618
flow_threshold=self.flow_threshold,
16191619
cellprob_threshold=self.cellprob_threshold,
16201620
channels=[2, 1],
1621-
)
1621+
)[0]
16221622
masks_cytosol = np.array(masks_cytosol) # convert to array
16231623

16241624
# manually delete model and perform gc to free up memory on GPU
@@ -1852,15 +1852,15 @@ def cellpose_segmentation(self, input_image):
18521852
np.max(input_image) - np.min(input_image)
18531853
) # min max normalize to 0-1 range as cellpose expects this
18541854

1855-
masks_cytosol, _, _, _ = model.eval(
1855+
masks_cytosol = model.eval(
18561856
[input_image],
18571857
rescale=self.rescale,
18581858
normalize=self.normalize,
18591859
diameter=self.diameter,
18601860
flow_threshold=self.flow_threshold,
18611861
cellprob_threshold=self.cellprob_threshold,
18621862
channels=[2, 1],
1863-
)
1863+
)[0]
18641864
masks_cytosol = np.array(masks_cytosol) # convert to array
18651865

18661866
# manually delete model and perform gc to free up memory on GPU

src/scportrait/pipeline/selection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ def _setup_selection(self):
8484
except KeyError:
8585
Warning("No name provided for the selection. Will use default name.")
8686
name = "selected_cells"
87+
else:
88+
name = self.name
8789

8890
# create savepath
8991
savename = name.replace(" ", "_") + ".xml"

0 commit comments

Comments
 (0)