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

Download faithful dataset #70

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

Stannislav
Copy link
Contributor

@Stannislav Stannislav commented Aug 30, 2021

Closes #95

Download a dataset and map the section images exactly as suggested by sync, e.g.:
Screenshot 2021-08-30 at 18 44 07

At the moment this is a dirty draft, and it's based on top of the branch in #66. Things will be refactored...

To do

  • Coronal datasets
  • RGB images
  • Refactor properly

Current high-level testing

Download the dataset using different parameters:

$ atldld dataset download-faithful 75492803 -o out
$ atldld dataset download-faithful 75492803 -o out --input-downsample=5
$ atldld dataset download-faithful 75492803 -o out --input-downsample=5 --output-scale=100

Preview in a notebook:

import pathlib

import ipywidgets as widgets
import numpy as np
from matplotlib.figure import Figure

%matplotlib inline

volume_0_25 = np.load("out/dataset-id-75492803-faithful-downsample-0-scale-25.npy")
volume_5_25 = np.load("out/dataset-id-75492803-faithful-downsample-5-scale-25.npy")
volume_5_100 = np.load("out/dataset-id-75492803-faithful-downsample-5-scale-100.npy")

volume_0_25.shape, volume_5_25.shape, volume_5_100.shape

compare downsampling 1

fig = Figure((15, 10))
fig.set_tight_layout(True)
ax1, ax2 = fig.subplots(1, 2, sharey=True)

ax1.set_title("downsample=0")
ax1.imshow(volume_0_25[:, 160, :].T, cmap="gray")
ax1.grid(True, linestyle=":", color="gray")

ax2.set_title("downsample=5")
ax2.imshow(volume_0_25[:, 160, :].T, cmap="gray")
ax2.grid(True, linestyle=":", color="gray")

fig

Screenshot 2021-08-30 at 18 50 28

compare downsampling 2

@widgets.interact(
    idx=widgets.IntSlider(value=100, min=0, max=volume_5_25.shape[-1]-1, continuous_update=False),
)
def _(idx):
    fig = Figure((15, 10))
    fig.set_tight_layout(True)
    
    ax1, ax2 = fig.subplots(1, 2, sharey=True)
    ax1.set_title("downsample=0")
    ax1.imshow(volume_0_25[..., idx].T, cmap="gray")
    ax2.set_title("downsample=5")
    ax2.imshow(volume_5_25[..., idx].T, cmap="gray")
    
    return fig

Screenshot 2021-08-30 at 18 51 01

compare output scale 1

fig = Figure((15, 10))
fig.set_tight_layout(True)
ax1, ax2 = fig.subplots(1, 2)

ax1.set_title("scale=25")
ax1.imshow(volume_5_25[:, 160, :].T, cmap="gray")
ax1.grid(True, linestyle=":", color="gray")

ax2.set_title("scale=100")
ax2.imshow(volume_5_100[:, 40, :].T, cmap="gray")
ax2.grid(True, linestyle=":", color="gray")

fig

Screenshot 2021-08-30 at 18 51 23

compare output scale 2

@widgets.interact(
    idx=widgets.IntSlider(value=25, min=0, max=volume_5_100.shape[-1]-1, continuous_update=False),
)
def _(idx):
    fig = Figure((15, 10))
    fig.set_tight_layout(True)
    
    ax1, ax2 = fig.subplots(1, 2)
    ax1.set_title("scale=25")
    ax1.imshow(volume_5_25[..., idx * 4].T, cmap="gray")
    ax2.set_title("scale=100")
    ax2.imshow(volume_5_100[..., idx].T, cmap="gray")
    
    return fig

Screenshot 2021-08-30 at 18 51 38

@Stannislav Stannislav self-assigned this Aug 31, 2021
@Stannislav Stannislav force-pushed the download-faithful-dataset branch 4 times, most recently from cc5ad68 to fc1210d Compare September 1, 2021 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the "downloads faithful dataset" CLI command
1 participant