Skip to content

Commit

Permalink
v0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Windhager committed Oct 19, 2021
1 parent 35051a0 commit 29e067c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.6.2] - 2021-10-19

Fixed broken computation of acquisition dimensions

## [v0.6.1] - 2021-10-19

Fixed bug related to positioning of acquisitions from old MCD files
Expand Down Expand Up @@ -32,6 +36,7 @@ Updated documentation
Last release before introducing this changelog


[v0.6.2]: https://github.com/BodenmillerGroup/napari-imc/compare/v0.6.1...v0.6.2
[v0.6.1]: https://github.com/BodenmillerGroup/napari-imc/compare/v0.6.0...v0.6.1
[v0.6.0]: https://github.com/BodenmillerGroup/napari-imc/compare/v0.5.6...v0.6.0
[v0.5.6]: https://github.com/BodenmillerGroup/napari-imc/compare/v0.5.4...v0.5.6
Expand Down
2 changes: 1 addition & 1 deletion napari_imc/imc_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class IMCWidget(QWidget):
NAME = 'Imaging Mass Cytometry'
FULL_NAME = f'napari-imc: {NAME}'
FULL_NAME = 'Imaging Mass Cytometry'
AREA = 'right'
ALLOWED_AREAS = ['left', 'right']

Expand Down
30 changes: 13 additions & 17 deletions napari_imc/io/mcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@ def read_panorama(self, panorama_id: int) -> Tuple[ImageDimensions, np.ndarray]:
for panorama in slide.panoramas
if panorama.id == panorama_id
)
xs_physical = [panorama.x1_um, panorama.x2_um, panorama.x3_um, panorama.x4_um]
ys_physical = [panorama.y1_um, panorama.y2_um, panorama.y3_um, panorama.y4_um]
x_physical, y_physical = min(xs_physical), min(ys_physical)
w_physical, h_physical = max(xs_physical) - x_physical, max(ys_physical) - y_physical
data = self._mcd_file.read_panorama(panorama)
if x_physical != panorama.x1_um:
data = data[:, ::-1, :]
if y_physical != panorama.y1_um:
data = data[::-1, :, :]
return (x_physical, y_physical, w_physical, h_physical), data
x = min(panorama.x1_um, panorama.x2_um, panorama.x3_um, panorama.x4_um)
y = min(panorama.y1_um, panorama.y2_um, panorama.y3_um, panorama.y4_um)
img = self._mcd_file.read_panorama(panorama)
if x != panorama.x1_um:
img = img[:, ::-1, :]
if y != panorama.y1_um:
img = img[::-1, :, :]
return (x, y, panorama.width_um, panorama.height_um), img

def read_acquisition(self, acquisition_id: int, channel_label: str) -> Tuple[ImageDimensions, np.ndarray]:
acquisition = next(
Expand All @@ -51,16 +49,14 @@ def read_acquisition(self, acquisition_id: int, channel_label: str) -> Tuple[Ima
if acquisition.id == acquisition_id
)
channel_index = acquisition.channel_labels.index(channel_label)
x_physical = min(acquisition.start_x_um, acquisition.end_x_um)
y_physical = min(acquisition.start_y_um, acquisition.end_y_um)
w_physical = x_physical + acquisition.width_um
h_physical = y_physical + acquisition.height_um
x = min(acquisition.start_x_um, acquisition.end_x_um)
y = min(acquisition.start_y_um, acquisition.end_y_um)
channel_img = self._mcd_file.read_acquisition(acquisition)[channel_index]
if x_physical != acquisition.start_x_um:
if x != acquisition.start_x_um:
channel_img = channel_img[:, ::-1]
if y_physical != acquisition.start_y_um:
if y != acquisition.start_y_um:
channel_img = channel_img[::-1, :]
return (x_physical, y_physical, w_physical, h_physical), channel_img
return (x, y, acquisition.width_um, acquisition.height_um), channel_img

def __enter__(self) -> 'FileReaderBase':
self._mcd_file = IMCMcdFile(self._path)
Expand Down

0 comments on commit 29e067c

Please sign in to comment.