Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c1002fb
load data from h5, spec scan: init work on handling pkl w/o scan params
Aug 7, 2019
9099bc8
lifetime: added prompt for skip rows, can now load csv
Aug 12, 2019
6a0406c
added skip rows prompt for irf
Aug 12, 2019
959d317
fix load phd
Aug 12, 2019
051c756
added analyze lifetime/spectrum from flim, clear lifetime export data…
Aug 13, 2019
fc8cbbb
ui changes, fix FLIM image direction
Aug 13, 2019
e5aad83
added export fig for spectra scan, added export data for single spectrum
Aug 13, 2019
b65a738
window title changes, minor ui changes in MainDataBrowser
SarthakJariwala Aug 14, 2019
079a67f
remove old files that are not required
SarthakJariwala Aug 14, 2019
95ddb39
initial work on image analysis
Aug 16, 2019
11b21fe
resized image according to scaling_factor
Aug 19, 2019
73bb638
image_analysis: add grayscale option, flim: average instead of sum fo…
Aug 19, 2019
52be7a4
added pixera pixel size
Aug 19, 2019
0c6944e
fix scalebar -- include delay in update solved it
SarthakJariwala Aug 20, 2019
8fce783
image analysis: fix image orientation, roi height, add scalebar; spec…
Aug 20, 2019
1fa99d0
add comments
Aug 20, 2019
0c29d95
fix roi direction, keep pixera image size
Aug 21, 2019
5f21a07
fix roi plot orientationm spot greyscale
Aug 21, 2019
c196dda
initial work on separate rgb plot and horizontal rgb avg
Aug 21, 2019
d9844ad
moved pg.setConfigOption to init functions
Aug 21, 2019
45d4ac4
use separate image plot instead of imageview
Aug 22, 2019
9afb6b9
add default roi position and angle
Aug 22, 2019
f0505dd
update scaling factor before loading image
Aug 22, 2019
e41bf1e
add resize option for spot, fixed image plot axes
Aug 22, 2019
e2f3e9a
add interpolation to psf data
Aug 22, 2019
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
Prev Previous commit
Next Next commit
image_analysis: add grayscale option, flim: average instead of sum fo…
…r line profile
  • Loading branch information
LAKESIDE\LindaT18 committed Aug 19, 2019
commit 73bb638777e8a91b83c679ea6e8c9d62722e2f01
2 changes: 1 addition & 1 deletion PythonGUI_apps/FLIM_analysis/FLIM_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def line_profile_update_plot(self):
data, coords = roi.getArrayRegion(image.view(np.ndarray), self.ui.intensity_sums_viewBox.imageItem, axes, returnMappedCoords=True)

#calculate sums along columns in region
sums_to_plot = np.sum(data, axis=0)
sums_to_plot = np.mean(data, axis=0)

#get scan x-coordinates in region
x_values = coords[1][0]
Expand Down
30 changes: 20 additions & 10 deletions PythonGUI_apps/Image_analysis/Image_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@ def __init__(self):
self.roi = self.imv.roi
self.roi.translateSnap = True
self.roi.scaleSnap = True
self.update_camera() #initialize camera pixel size
self.update_scaling_factor() #initialize scaling_factor

self.roi_plot = self.imv.getRoiPlot().getPlotItem()

self.roi_plot = self.imv.getRoiPlot().getPlotItem() #get roi plot
self.ui.image_groupBox.layout().addWidget(self.imv)

#set up ui signals
self.roi.sigRegionChanged.connect(self.line_profile_update_plot)
self.ui.load_image_pushButton.clicked.connect(self.load_image)
self.ui.custom_pixel_size_checkBox.stateChanged.connect(self.switch_custom_pixel_size)
self.ui.update_scaling_factor_pushButton.clicked.connect(self.update_scaling_factor)
self.ui.spot_radioButton.toggled.connect(self.update_camera)

self.num_plots = 0
self.show()
Expand All @@ -57,26 +58,30 @@ def load_image(self):
try:
file = QtWidgets.QFileDialog.getOpenFileName(self, 'Open file', os.getcwd())
self.original_image = Image.open(file[0])
self.original_image = self.original_image.rotate(-90, expand=True)
#self.original_image = self.original_image.rotate(-90, expand=True)
self.resize_to_scaling_factor(self.original_image)
except Exception as err:
print(format(err))

def resize_to_scaling_factor(self, image):
"""
Handles loading of image according to scaling_factor
"""
image = image.resize((round(image.size[0]*self.scaling_factor), round(image.size[1]*self.scaling_factor)))
image_array = np.asarray(image)
if self.ui.greyscale_checkBox.isChecked():
image = image.convert("L") #convert to greyscale
image_array = np.asarray(image).T #correct numpy array auto-flip
width = image_array.shape[0]
height = image_array.shape[1]
try:
x_vals = np.arange(width)
x_vals = np.arange(width) #imv x-axis
self.imv.setImage(img=image_array, xvals= x_vals)
self.roi.setPos((0,0))
self.roi.setSize([width, height * self.scaling_factor]) #set line roi
self.line_profile_update_plot()
except:
pass


def line_profile_update_plot(self):
""" Handle line profile for intensity sum viewbox """
self.roi_plot.clear()
Expand Down Expand Up @@ -118,17 +123,22 @@ def update_scaling_factor(self):
if self.ui.custom_pixel_size_checkBox.isChecked():
self.scaling_factor = self.ui.custom_pixel_size_spinBox.value()
else:
pixel_size = 7.4
self.scaling_factor = pixel_size/int(self.ui.magnification_comboBox.currentText())
self.roi.snapSize = self.scaling_factor
self.scaling_factor = self.camera_pixel_size/int(self.ui.magnification_comboBox.currentText())
self.roi.snapSize = self.scaling_factor #roi snaps to multiples of scaling_factor
if hasattr(self, "original_image"):
self.resize_to_scaling_factor(self.original_image)
self.resize_to_scaling_factor(self.original_image) #resize image, sets up roi

def switch_custom_pixel_size(self):
checked = self.ui.custom_pixel_size_checkBox.isChecked()
self.ui.custom_pixel_size_spinBox.setEnabled(checked)
self.ui.magnification_comboBox.setEnabled(not checked)

def update_camera(self):
if self.ui.spot_radioButton.isChecked():
self.camera_pixel_size = 7.4
elif self.ui.pixera_radioButton.isChecked():
self.camera_pixel_size = 0

def close_application(self):
choice = QtGui.QMessageBox.question(self, 'EXIT!',
"Do you want to exit the app?",
Expand Down
74 changes: 56 additions & 18 deletions PythonGUI_apps/Image_analysis/image_analysis_gui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1059</width>
<width>1029</width>
<height>743</height>
</rect>
</property>
Expand Down Expand Up @@ -51,14 +51,21 @@
</item>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="2">
<widget class="QCheckBox" name="custom_pixel_size_checkBox">
<item row="6" column="0">
<widget class="QPushButton" name="load_image_pushButton">
<property name="text">
<string>Custom pixel size (um)</string>
<string>Load image</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="greyscale_checkBox">
<property name="text">
<string>Greyscale image</string>
</property>
</widget>
</item>
<item row="0" column="3">
<item row="3" column="1">
<widget class="QComboBox" name="magnification_comboBox">
<item>
<property name="text">
Expand All @@ -75,30 +82,61 @@
<string>100</string>
</property>
</item>
<item>
<property name="text">
<string>150</string>
</property>
</item>
</widget>
</item>
<item row="1" column="3">
<widget class="QDoubleSpinBox" name="custom_pixel_size_spinBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Magnification</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QPushButton" name="load_image_pushButton">
<item row="5" column="0">
<widget class="QCheckBox" name="custom_pixel_size_checkBox">
<property name="text">
<string>Load image</string>
<string>Custom pixel size (um)</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="custom_pixel_size_spinBox">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Camera</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="spot_radioButton">
<property name="text">
<string>SPOT</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="pixera_radioButton">
<property name="text">
<string>Pixera</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="2" colspan="2">
<item row="8" column="0">
<widget class="QPushButton" name="update_scaling_factor_pushButton">
<property name="text">
<string>Update scaling factor</string>
Expand All @@ -117,7 +155,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1059</width>
<width>1029</width>
<height>31</height>
</rect>
</property>
Expand Down