Skip to content

Commit

Permalink
Add google forms and banner
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallory Wittwer committed Jan 12, 2024
1 parent 29bc7ca commit 0bba212
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 111 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
![EPFL Center for Imaging logo](https://imaging.epfl.ch/resources/logo-for-gitlab.svg)
# The Image Analysis Field Guide

A [Jupyter Book] website
Essential toolkit to get started in scientific image analysis.

👉 See the live website at [this URL](https://EPFL-Center-for-Imaging.github.io/image-analysis-field-guide/).
👉 See the live website at [this URL](https://epfl-center-for-imaging.github.io/image-analysis-field-guide/).

-------------------------

## Installation

Expand Down
7 changes: 4 additions & 3 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ New to image analysis? These short guides will help you start off on the right f

- [🐍 Setting up Python for scientific image analysis](./sections/getting_started/pages/python_setup.md)
- [🚩 Starting a new image analysis project](./sections/getting_started/pages/new_project.md)
- More to come!

## 🚀 Starter packs

Expand Down Expand Up @@ -63,6 +64,8 @@ Performance optimization
```
````

Want to add a Starter Pack? See [Contribute](#🤝-contribute).

## 📚 Exploring further

Browse our collections of online resources, python examples, and software tools related to image analysis.
Expand All @@ -81,9 +84,7 @@ Browse our collections of online resources, python examples, and software tools

## 🤝 Contribute

Please check out our [Contributor's guide](https://github.com/MalloryWittwer/image-analysis-field-guide/blob/main/contribute.md) to learn more about the many ways to contribute to our project.

We’d be happy to receive your suggestions and to know more about the topics you are interested in!
Please check out our [Contributor's guide](https://github.com/MalloryWittwer/image-analysis-field-guide/blob/main/contribute.md) to learn more about the ways to contribute to our project.

## 🖋️ Feedback

Expand Down
2 changes: 1 addition & 1 deletion src/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repository:
# Add GitHub buttons to your book
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
html:
announcement: "🏗️ This site is under construction!"
announcement: "🏗️ [Jan 2024] This site is under construction!"
favicon: "logo.ico"
use_issues_button: false
use_repository_button: true
Expand Down
22 changes: 1 addition & 21 deletions src/helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,9 @@

def filter_online_resources(tags: List[str]):
df = DATAFRAME_ONLINE_RESOURCES.copy()

df["Name"] = [
'<a href="{}">{}</a>'.format(link, name)
for link, name in zip(df["Link"], df["Name"])
]

mask = df['Keywords'].str.contains('|'.join(tags), na=False)
filtered_df = df[mask].copy()


filtered_df.drop(['Link', 'Keywords'], axis='columns', inplace=True)
filtered_df.drop('Keywords', axis='columns', inplace=True)

return filtered_df

Expand Down Expand Up @@ -94,20 +86,8 @@ def filter_notebook_case_studies(tags: List[str]):

def filter_software_tools(tags: List[str]):
df = DATAFRAME_SOFTWARE_TOOLS.copy()

df["Software tool"] = [
'<a href="{}">{}</a>'.format(link, name)
for link, name in zip(df["Homepage"], df["Software tool"])
]

df["Keywords"] = [
''.join(['<button class="btn btn-light btn-xs" onclick="insertText(this)" style="padding: 1px; margin: 4px 2px; font-size: 12px;">{}</button>'.format(keyword) for keyword in [kw for kw in str(keywords).split(', ') if kw != 'nan']])
for keywords in df["Keywords"]
]

mask = df['Used for'].str.contains('|'.join(tags), na=False)
filtered_df = df[mask].copy()

filtered_df.drop(['Homepage', 'Used for'], axis='columns', inplace=True)

return filtered_df
Expand Down
4 changes: 3 additions & 1 deletion src/helpers/generate_notebook_case_studies.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_notebook_case_studies_dataframe():
"""
basedir = str(Path(__file__).parents[1] / 'sections')
notebooks = glob.glob(f"{basedir}/**/*.ipynb", recursive=True)
# print(f"Found {len(notebooks)} notebooks to parse.")

items = []
for ipath in notebooks:
ntbk = nbf.read(ipath, nbf.NO_CONVERT)
Expand All @@ -62,6 +62,8 @@ def get_notebook_case_studies_dataframe():
items.append(parsed_info)

df = pd.DataFrame(items)



return df

Expand Down
37 changes: 33 additions & 4 deletions src/helpers/notion_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,47 @@ def get_online_resources_dataframe() -> pd.DataFrame:
online_resources_data = query_notion_database(ONLINE_RESOURCES_DATABASE_ID)
items = parse_online_resources(online_resources_data)
df = pd.DataFrame(items)

df["Name"] = [
'<a href="{}">{}</a>'.format(link, name)
for link, name in zip(df["Link"], df["Name"])
]

df.drop('Link', axis='columns', inplace=True)

df["Keywords"] = [
''.join(['<button class="btn btn-light btn-xs" onclick="insertText(this)" style="padding: 1px; margin: 4px 2px; font-size: 12px;">{}</button>'.format(keyword) for keyword in [kw for kw in str(keywords).split(', ') if kw != 'nan']])
for keywords in df["Keywords"]
]

return df

def get_software_tools_dataframe() -> pd.DataFrame:
software_tools_data = query_notion_database(SOFTWARE_TOOLS_DATABASE_ID)
items = parse_software_tools(software_tools_data)
df = pd.DataFrame(items)

df["Software tool"] = [
'<a href="{}">{}</a>'.format(link, name)
for link, name in zip(df["Homepage"], df["Software tool"])
]

df.drop(['Homepage'], axis='columns', inplace=True)

df["Used for"] = [
''.join(['<button class="btn btn-light btn-xs" onclick="insertText(this)" style="padding: 1px; margin: 4px 2px; font-size: 12px;">{}</button>'.format(keyword) for keyword in [kw for kw in str(keywords).split(', ') if kw != 'nan']])
for keywords in df["Used for"]
]

df["Keywords"] = [
''.join(['<button class="btn btn-light btn-xs" onclick="insertText(this)" style="padding: 1px; margin: 4px 2px; font-size: 12px;">{}</button>'.format(keyword) for keyword in [kw for kw in str(keywords).split(', ') if kw != 'nan']])
for keywords in df["Keywords"]
]

return df

def parse_online_resources(data: dict) -> List[dict]:
"""
Extract useful data from the raw Notion database contents.
"""
"""Extract data from the raw Notion database contents."""
items = []

for page_contents in data.get('results'):
Expand All @@ -44,7 +73,7 @@ def parse_online_resources(data: dict) -> List[dict]:

def parse_software_tools(data: dict) -> List[dict]:
"""
Extract useful data from the raw Notion database contents.
Extract data from the raw Notion database contents.
"""
items = []

Expand Down
Binary file added src/images/jupyterhub.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 15 additions & 16 deletions src/sections/exploring_further/notebook_case_studies/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,28 @@ kernelspec:

Browse our collection of Jupyter notebooks to learn more about scientific image processing and analysis in Python.

````{admonition} Launch the notebooks
Launch the notebooks to run them interactively on our `Jupyter Hub` by clicking on the rocket icon (🚀) at the top of this page (only EPFL).
```{image} ../../../images/jupyterhub.png
:align: center
```
````

```{code-cell} ipython3
:tags: [remove-input]
import pandas as pd
from itables import init_notebook_mode
from itables import show
from pathlib import Path
init_notebook_mode(all_interactive=True, connected=True)
import sys
from pathlib import Path
sys.path.append(str(Path.cwd().parents[2]))
from helpers import DATAFRAME_NOTEBOOK_CASE_STUDIES
from helpers import DATAFRAME_NOTEBOOK_CASE_STUDIES, show_notebook_case_studies
df = DATAFRAME_NOTEBOOK_CASE_STUDIES.copy()
# df = pd.read_csv(Path.cwd().parents[3] / 'db' / 'notebook_case_studies.csv')
df["Title"] = [
'<a href="./notebooks/{}">{}</a>'.format(link, name)
Expand All @@ -40,15 +47,7 @@ df["Image"] = [
for image in df["Image"]
]
df.drop(['Link', 'Keywords'], axis='columns', inplace=True)
show(
df,
classes="display compact",
columnDefs=[
{"className": "dt-left", "targets": [0, 1]}
],
paging=False,
showIndex=False,
)
df.drop(['Link', 'Keywords', 'Description'], axis='columns', inplace=True)
show_notebook_case_studies(df)
```
37 changes: 6 additions & 31 deletions src/sections/exploring_further/online_resources/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,15 @@ Do you want to add a resource to our list? Fill-in our [Google Form](https://doc
```{code-cell} ipython3
:tags: [remove-input]
import pandas as pd
from itables import init_notebook_mode
from itables import show
from pathlib import Path
init_notebook_mode(all_interactive=True, connected=True)
import sys
from pathlib import Path
sys.path.append(str(Path.cwd().parents[2]))
from helpers import DATAFRAME_ONLINE_RESOURCES
df = DATAFRAME_ONLINE_RESOURCES.copy()
# df = pd.read_csv(Path.cwd().parents[3] / 'db' / 'online_resources.csv')
df["Name"] = [
'<a href="{}">{}</a>'.format(link, name)
for link, name in zip(df["Link"], df["Name"])
]
df.drop('Link', axis='columns', inplace=True)
df["Keywords"] = [
''.join(['<button class="btn btn-light btn-xs" onclick="insertText(this)" style="padding: 1px; margin: 4px 2px; font-size: 12px;">{}</button>'.format(keyword) for keyword in [kw for kw in str(keywords).split(', ') if kw != 'nan']])
for keywords in df["Keywords"]
]
# show(df, classes="display compact", paging=False)
show(
df,
classes="display compact",
columnDefs=[
{"className": "dt-left", "targets": "_all"}
],
style="width:100%;margin:auto",
paging=False,
showIndex=False,
)
from helpers import DATAFRAME_ONLINE_RESOURCES, show_online_resources
show_online_resources(DATAFRAME_ONLINE_RESOURCES)
```
36 changes: 4 additions & 32 deletions src/sections/exploring_further/software_tools/page.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,16 @@ Do you want to add a software tool to our list? Fill-in our [Google Form](https:
```{code-cell} ipython3
:tags: [remove-input]
import pandas as pd
from itables import init_notebook_mode
from itables import show
from pathlib import Path
init_notebook_mode(all_interactive=True, connected=True)
import sys
sys.path.append(str(Path.cwd().parents[2]))
from helpers import DATAFRAME_SOFTWARE_TOOLS
df = DATAFRAME_SOFTWARE_TOOLS.copy()
# df = pd.read_csv(Path.cwd().parents[3] / 'db' / 'software_tools.csv')
df["Software tool"] = [
'<a href="{}">{}</a>'.format(link, name)
for link, name in zip(df["Homepage"], df["Software tool"])
]
df.drop(['Homepage'], axis='columns', inplace=True)
from pathlib import Path
df["Used for"] = [
''.join(['<button class="btn btn-light btn-xs" onclick="insertText(this)" style="padding: 1px; margin: 4px 2px; font-size: 12px;">{}</button>'.format(keyword) for keyword in [kw for kw in str(keywords).split(', ') if kw != 'nan']])
for keywords in df["Used for"]
]
sys.path.append(str(Path.cwd().parents[2]))
df["Keywords"] = [
''.join(['<button class="btn btn-light btn-xs" onclick="insertText(this)" style="padding: 1px; margin: 4px 2px; font-size: 12px;">{}</button>'.format(keyword) for keyword in [kw for kw in str(keywords).split(', ') if kw != 'nan']])
for keywords in df["Keywords"]
]
from helpers import DATAFRAME_SOFTWARE_TOOLS, show_software_tools
show(
df,
classes="display compact",
columnDefs=[
{"className": "dt-left", "targets": "_all"}
],
style="width:100%;margin:auto",
paging=False,
showIndex=False,
)
show_software_tools(DATAFRAME_SOFTWARE_TOOLS)
```

0 comments on commit 0bba212

Please sign in to comment.