Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lecture05 #7

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5d971e7
Fixed plot
dveni Mar 7, 2024
d8d1940
Updated path to figure for the pdf generation.
anderskaestner Mar 7, 2024
63af18a
Added a note about the structure tensor.
anderskaestner Mar 10, 2024
00c08db
Checked lecture 4 part 1
anderskaestner Mar 11, 2024
7136758
Updated lecture 4 part 2
anderskaestner Mar 11, 2024
58ddcf6
Merge pull request #6 from ImagingLectures/lecture04
anderskaestner Mar 11, 2024
39bec14
Merge pull request #5 from ImagingLectures/fix/exercise-3-demo
anderskaestner Mar 11, 2024
428f2c9
Update to exercise 4
dveni Mar 13, 2024
15a8758
Went through lecture 5. Essentially ok. But parts can be improved.
anderskaestner Mar 13, 2024
5bb062b
Merge pull request #8 from ImagingLectures/lecture05
anderskaestner Mar 13, 2024
5d31f00
Merge pull request #7 from ImagingLectures/update/exercise4
anderskaestner Mar 14, 2024
585d36e
Screen preparations of lecture 4 and updating lecture 5
anderskaestner Mar 14, 2024
c0160ac
Fixed text and titles
dveni Mar 14, 2024
9dc260e
Merge pull request #9 from ImagingLectures/update/exercise4
dveni Mar 14, 2024
146605d
Update wioth phase image
dveni Mar 14, 2024
fcb5f43
Merge pull request #10 from ImagingLectures/update/exercise4
anderskaestner Mar 14, 2024
81d0906
Added post lecture material to lecture 4
anderskaestner Mar 14, 2024
1f9a510
Adding missing figures
anderskaestner Mar 14, 2024
c80f0b3
Merge branch 'main' of https://github.com/ImagingLectures/Quantitativ…
anderskaestner Mar 14, 2024
15a8b12
Fixed conflicts
anderskaestner Mar 14, 2024
0abc284
Fixed last errors
anderskaestner Mar 15, 2024
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
121 changes: 108 additions & 13 deletions Exercises/03-ImageEnhancement/03-Demonstration.ipynb

Large diffs are not rendered by default.

270 changes: 104 additions & 166 deletions Exercises/04-Segmentation/04-Exercises-Solution.ipynb

Large diffs are not rendered by default.

212 changes: 156 additions & 56 deletions Exercises/04-Segmentation/04-Exercises.ipynb

Large diffs are not rendered by default.

Binary file added Exercises/04-Segmentation/04-files/lung.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file added Exercises/04-Segmentation/04-files/lung_phase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
391 changes: 223 additions & 168 deletions Lectures/Lecture-03/03-ImageEnhancement.ipynb

Large diffs are not rendered by default.

1,041 changes: 657 additions & 384 deletions Lectures/Lecture-04/04-BasicSegmentation.ipynb

Large diffs are not rendered by default.

733 changes: 506 additions & 227 deletions Lectures/Lecture-04/04-BasicSegmentation_Part2.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Lectures/Lecture-04/Normalization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.15"
"version": "3.11.0"
},
"varInspector": {
"cols": {
Expand Down
4 changes: 2 additions & 2 deletions Lectures/Lecture-04/_toc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
format: jb-article
root: preface
sections:
- file: 04-BasicSegmentation
- file: 04-BasicSegmentation_Part2
- file: 04-BasicSegmentation
- file: 04-BasicSegmentation_Part2
Binary file not shown.
1,068 changes: 1,068 additions & 0 deletions Lectures/Lecture-04/figures/ambiguous_transmission.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 17 additions & 4 deletions Lectures/Lecture-04/plotsupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from matplotlib.colors import ListedColormap
import matplotlib.colors as colors
from sklearn.metrics import confusion_matrix
from seaborn import heatmap
# from seaborn import heatmap
import numpy as np

def buildCMap(plots) :
Expand All @@ -13,6 +13,18 @@ def buildCMap(plots) :

return ListedColormap(cmaplist)

def heatmap(img, ax=None, cmap='inferno', fontsize=14, precision=3) :
if ax is None :
_,ax=plt.subplots(1)

ax.imshow(img,cmap=cmap,origin='upper')
ax.set(xticks=np.arange(0,img.shape[0]),yticks=np.arange(0,img.shape[0]))
props = dict(boxstyle='round', facecolor='lightgray', alpha=1)
for i in range(img.shape[1]):
for j in range(img.shape[0]):
text = ax.text(j, i, "{0:0.{1}f}".format(img[i, j],precision),
ha="center", va="center", fontsize=fontsize, color="k",bbox=props)

def magnifyRegion(img,roi, figsize, cmap='gray',vmin=0,vmax=0,title='Original') :
if vmin==vmax:
vmin=img.min()
Expand All @@ -30,7 +42,7 @@ def magnifyRegion(img,roi, figsize, cmap='gray',vmin=0,vmax=0,title='Original')
ax[1].set_title('Magnified ROI')


def showHitMap(gt,pr,ax=None) :
def showHitMap(gt,pr,ax=None, annot_kws = None) :
if ax is None :
fig, ax = plt.subplots(1,2,figsize=(12,4))

Expand All @@ -46,7 +58,8 @@ def showHitMap(gt,pr,ax=None) :
ax[1].set_title('Hit map')

cmat = confusion_matrix(gt.ravel(), pr.ravel(), normalize='all')
heatmap(cmat, annot=True,ax=ax[0]); ax[0].set_title('Confusion matrix');
# heatmap(cmat, annot=True,ax=ax[0], annot_kws=annot_kws); ax[0].set_title('Confusion matrix');
heatmap(cmat, ax=ax[0]); ax[0].set_title('Confusion matrix');
ax[0].set_xticklabels(['Negative','Positive']);
ax[0].set_yticklabels(['Negative','Positive']);
ax[0].set_ylabel('Ground Truth')
Expand Down Expand Up @@ -87,7 +100,7 @@ def visualize_normalization(img, ob, dc,norm) :
ax3.imshow(ob,clim=[mo-2*so,mo+2*so],cmap='gray')
ax3.set_xticks([])
ax3.set_yticks([])
ax3.set_title('Illumination')
ax3.set_title('Source profile')


ax4.imshow(dc,clim=[md-2*sd,md+2*sd],cmap='gray')
Expand Down
572 changes: 275 additions & 297 deletions Lectures/Lecture-05/05-AdvancedSegmentation.ipynb

Large diffs are not rendered by default.

Loading