Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def _calculate(self, event=None):
)
return
data_scale = data_layer.scale[-3:] / UNIT_SCALE[self.scale_units_select.get_value().value]
image = Image(data_layer.data, data_scale, axes_order="TZYX"[-data_ndim:])
image = Image(data_layer.data, spacing=data_scale, axes_order="TZYX"[-data_ndim:])
worker = _prepare_data(profile, image, self.labels_choice.value.data)
worker.returned.connect(self._calculate_next)
worker.errored.connect(self._finished)
Expand Down
6 changes: 3 additions & 3 deletions package/PartSeg/plugins/napari_widgets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from PartSeg.common_gui.custom_save_dialog import FormDialog
from PartSegCore import UNIT_SCALE, Units
from PartSegCore.algorithm_describe_base import AlgorithmProperty
from PartSegImage import Channel, Image
from PartSegImage import Channel, ChannelInfo, Image


class QtNapariAlgorithmProperty(QtAlgorithmProperty):
Expand Down Expand Up @@ -69,9 +69,9 @@ def generate_image(viewer: Viewer, *layer_names):
image_list.append(
Image(
image_layer.data,
data_scale,
spacing=data_scale,
axes_order=axis_order[-image_layer.data.ndim :],
channel_names=[image_layer.name],
channel_info=[ChannelInfo(name=name.value)],
)
)
res_image = image_list[0]
Expand Down
4 changes: 2 additions & 2 deletions package/PartSegCore/analysis/measurement_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def get_global_parameters(self):
res = [name]
iterator = iter(self._data_dict.keys())
with suppress(StopIteration):
next(iterator) # skipcq: PTC-W0063`
next(iterator) # skipcq: PTC-W0063
else:
res = []
iterator = iter(self._data_dict.keys())
Expand All @@ -233,7 +233,7 @@ def _prepare_res_iterator(self, counts):
res = [[name] for _ in range(counts)]
iterator = iter(self._data_dict.keys())
with suppress(StopIteration):
next(iterator) # skipcq: PTC-W0063`
next(iterator) # skipcq: PTC-W0063
else:
res = [[] for _ in range(counts)]
iterator = iter(self._data_dict.keys())
Expand Down
4 changes: 2 additions & 2 deletions package/PartSegCore/image_transforming/image_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def transform(
return (
image.__class__(
data=new_channels,
image_spacing=tuple(spacing),
channel_names=image.channel_names,
spacing=tuple(spacing),
channel_info=image.channel_info,
mask=new_mask,
axes_order=image.axis_order,
),
Expand Down
2 changes: 1 addition & 1 deletion package/PartSegCore/mask/io_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _save_mask_roi(project: MaskProjectTuple, tar_file: tarfile.TarFile, paramet
spacing = project.image.spacing
else:
spacing = parameters.spacing
segmentation_image = Image(project.roi_info.roi, spacing, axes_order=Image.axis_order.replace("C", ""))
segmentation_image = Image(project.roi_info.roi, spacing=spacing, axes_order=Image.axis_order.replace("C", ""))
try:
ImageWriter.save(segmentation_image, segmentation_buff, compression=None)
except ValueError:
Expand Down
10 changes: 5 additions & 5 deletions package/PartSegCore/napari_plugins/save_tiff_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np
from napari.types import FullLayerData

from PartSegImage import Image, ImageWriter
from PartSegImage import ChannelInfo, Image, ImageWriter
from PartSegImage.image import DEFAULT_SCALE_FACTOR


Expand All @@ -15,9 +15,9 @@ def napari_write_labels(path: str, data: Any, meta: dict) -> Optional[str]:
scale_shift = min(data.ndim, 3)
image = Image(
data,
np.divide(meta["scale"], DEFAULT_SCALE_FACTOR)[-scale_shift:],
spacing=np.divide(meta["scale"], DEFAULT_SCALE_FACTOR)[-scale_shift:],
axes_order="TZYX"[-data.ndim :],
channel_names=[meta["name"]],
channel_info=[ChannelInfo(name=meta["name"])],
shift=np.divide(meta["translate"], DEFAULT_SCALE_FACTOR)[-scale_shift:],
name="ROI",
)
Expand Down Expand Up @@ -50,9 +50,9 @@ def napari_write_images(path: str, layer_data: List[FullLayerData]) -> List[str]
scale_shift -= 1
image = Image(
data,
np.divide(meta["scale"], DEFAULT_SCALE_FACTOR)[-scale_shift:],
spacing=np.divide(meta["scale"], DEFAULT_SCALE_FACTOR)[-scale_shift:],
axes_order=axes,
channel_names=channel_names,
channel_info=[ChannelInfo(name=x) for x in channel_names],
shift=np.divide(meta["translate"], DEFAULT_SCALE_FACTOR)[-scale_shift:],
name="Image",
)
Expand Down
4 changes: 3 additions & 1 deletion package/PartSegImage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from PartSegImage import tifffile_fixes # noqa: F401
from PartSegImage.channel_class import Channel
from PartSegImage.image import Image
from PartSegImage.image import ChannelInfo, ChannelInfoFull, Image
from PartSegImage.image_reader import (
CziImageReader,
GenericImageReader,
Expand All @@ -17,6 +17,8 @@
__all__ = (
"BaseImageWriter",
"Channel",
"ChannelInfo",
"ChannelInfoFull",
"Image",
"TiffImageReader",
"IMAGEJImageWriter",
Expand Down
Loading
Loading