Skip to content

Commit

Permalink
ref: QuickView code needed tidying up
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jan 12, 2025
1 parent 7443f52 commit 124a873
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions shapeout2/gui/quick_view/qv_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ def rtdc_ds(self, rtdc_ds):
self.comboBox_y.set_dataset(rtdc_ds)
self.comboBox_z_hue.set_dataset(rtdc_ds)

## Showing image data
def get_event_image(self, ds, event, feat="image"):
"""Handle the image processing and contour processing for the event"""
state = self.read_pipeline_state()
Expand Down Expand Up @@ -390,6 +391,12 @@ def _prepare_event_image_qpi_amp(self, ds, event, state):

return cell_img

@staticmethod
def _convert_to_rgb(cell_img):
cell_img = cell_img.reshape(
cell_img.shape[0], cell_img.shape[1], 1)
return np.repeat(cell_img, 3, axis=2)

def _prepare_event_image_qpi_pha(self, ds, event, state):
cell_img = ds["qpi_pha"][event]
# colormap levels
Expand Down Expand Up @@ -480,12 +487,6 @@ def show_image(self, feat, view, cell_img):
self.img_info[feat][view].setColorMap(self.img_info[feat]["cmap"])
self.img_info[feat][view].show()

@staticmethod
def _convert_to_rgb(cell_img):
cell_img = cell_img.reshape(
cell_img.shape[0], cell_img.shape[1], 1)
return np.repeat(cell_img, 3, axis=2)

@staticmethod
def image_zoom(cell_img, mask):
xv, yv = np.where(mask)
Expand All @@ -500,6 +501,7 @@ def image_zoom(cell_img, mask):
idmaxy = idmaxy if idmaxy < shy else shy
return cell_img[idminx:idmaxx, idminy:idmaxy]

## Statistics
def get_statistics(self):
if self.rtdc_ds is not None:
features = [self.comboBox_x.currentData(),
Expand All @@ -521,6 +523,7 @@ def get_statistics(self):
else:
return None, None

## Scatter Plot
@QtCore.pyqtSlot(object, object)
def on_event_scatter_clicked(self, plot, point):
"""User clicked on scatter plot
Expand Down Expand Up @@ -597,6 +600,7 @@ def on_event_scatter_update(self):
event = self.spinBox_event.value()
self.show_event(event - 1)

## Polygon Selection
@QtCore.pyqtSlot()
def on_poly_create(self):
"""User wants to create a polygon filter"""
Expand Down Expand Up @@ -694,6 +698,7 @@ def on_poly_modify(self):
# add ROI
self.widget_scatter.activate_poly_mode(pf.points)

## Buttons
@QtCore.pyqtSlot()
def on_stats2clipboard(self):
"""Copy the statistics as tsv data to the clipboard"""
Expand Down

0 comments on commit 124a873

Please sign in to comment.