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
21 changes: 16 additions & 5 deletions marge/controller/controller_plot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
from marge.widgets.widget_plot3d import Plot3DWidget
import marge.configs.hw_config as hw
import pyqtgraph as pg
from marge.seq.pulserver_console import console_mode

#: Sign of the box's turn on the Transversal plane about MaRGE's axis 0. The box
#: turns from axis 2 towards axis 1, about -axis 0; pulserver's console reads
#: the angle as right-handed about the axis, so it takes the sign that says so.
TRANSVERSAL_TURN = -1 if console_mode() else 1


class Plot3DController(Plot3DWidget):
Expand Down Expand Up @@ -57,7 +63,7 @@ def __init__(self, data=np.array([]), x_label='', y_label='', title='', *args, *
self.roiFOV.setPen(pg.mkPen('r', width=3))
self.roiFOV.hoverPen = pg.mkPen('g', width=3)
self.roiFOV.addScaleHandle([1, 1], [0.5, 0.5])
# self.roiFOV.addRotateHandle([0, 0], [0.5, 0.5])
self.roiFOV.addRotateHandle([0, 0], [0.5, 0.5])

# Manage colors
for h in self.roiFOV.handles:
Expand Down Expand Up @@ -136,13 +142,13 @@ def menuClicked(self):
y_axis = 0
z_axis = 2
elif self.title == "Coronal":
a = -1
a = 1
d = [1, 1] #[RL, IS]
x_axis = 2
y_axis = 0
z_axis = 1
elif self.title == "Transversal":
a = 1
a = TRANSVERSAL_TURN
d = [1, 1] #[RL, PA]
x_axis = 2
y_axis = 1
Expand All @@ -156,9 +162,14 @@ def menuClicked(self):
if self.seq_name in defaultsequences.keys():
roi_fov = np.array(defaultsequences[self.seq_name].mapVals['fov']) * 1e-2 # m
roi_pos = np.array(defaultsequences[self.seq_name].mapVals['dfov']) * 1e-3 # m
# The box is drawn turned only on the plane whose normal is the rotation axis
seq_vals = defaultsequences[self.seq_name].mapVals
axis = np.asarray(seq_vals.get('rotationAxis', [0, 0, 0]), dtype=float)
roi_angle = a * float(seq_vals.get('angle', 0.0)) if axis[z_axis] != 0 and np.count_nonzero(axis) == 1 else 0.0
else:
roi_fov = img_fov
roi_pos = [0.0, 0.0, 0.0]
roi_angle = 0.0

img_fov_px = np.array(np.shape(self.getProcessedImage()))[1::]
img_fov_ru = [img_fov[x_axis], img_fov[y_axis]]
Expand All @@ -172,7 +183,7 @@ def menuClicked(self):
# Set roi size and angle
self.roiFOV.setPos(roi_pos_px, update=False)
self.roiFOV.setSize(roi_fov_px, update=False)
self.roiFOV.setAngle(0.0, update=False)
self.roiFOV.setAngle(roi_angle, center=[0.5, 0.5], update=False)
self.roiFOV.stateChanged()

# Show the roi
Expand Down Expand Up @@ -212,7 +223,7 @@ def roiFOVChanged(self):
y_axis = 0
z_axis = 1
elif self.title == "Transversal":
a = 1
a = TRANSVERSAL_TURN
d = [1, 1]
x_axis = 2
y_axis = 1
Expand Down
3 changes: 3 additions & 0 deletions marge/seq/pulserver_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,9 @@ def __init__(self) -> None:
self.addParameter(key="pulserverConsole", val=True)
self.addParameter(key="fov", val=[25.6, 25.6, 25.6], units=1e-2)
self.addParameter(key="dfov", val=[0.0, 0.0, 0.0], units=1e-3)
# Carried so that the localizer's FOV box is redrawn turned as planned.
self.addParameter(key="angle", val=0.0, units=1)
self.addParameter(key="rotationAxis", val=[1.0, 0.0, 0.0], units=1)
self.files: list[bytes] = []

def sequenceRun(self, plotSeq=0, demo=False) -> bool: # noqa: N802 -- MaRGE's API
Expand Down
8 changes: 8 additions & 0 deletions marge/ui/window_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import datetime
import sys
from PyQt5.QtWidgets import (
QMainWindow, QStatusBar, QWidget, QHBoxLayout, QVBoxLayout, QTableWidget,
QSizePolicy
Expand Down Expand Up @@ -158,3 +159,10 @@ def __init__(self, session, demo=False, parent=None):
# Add printer
self.printer = Printer(main=self)


def show(self):
"""Show the window; in a browser tab, filling the tab, so that the history below the figures is in view."""
if sys.platform == "emscripten":
self.showMaximized()
else:
super().show()
Loading