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

Refactor sync.py module #56

Merged
merged 6 commits into from
Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ dataset_ids = get_experiment_list_from_gene("Pvalb", axis='sagittal')
- One can download any dataset from a dataset ID:
```python
from atldld.sync import download_dataset_parallel
dataset = download_dataset(dataset_id=DATASET_ID, **kwargs)
dataset = download_dataset_parallel(dataset_id=DATASET_ID, **kwargs)
Stannislav marked this conversation as resolved.
Show resolved Hide resolved
image_id, section_number, img, df = next(dataset)
```
Note that this functionality makes a simplifying assumption that
the slices are perfectly parallel to one of the 3 axes.

- One can obtain metadata of a dataset:
```python
Expand Down
11 changes: 6 additions & 5 deletions docs/source/allen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,21 @@ Single image download

Full-blown registration
~~~~~~~~~~~~~~~~~~~~~~~
The most useful function is the :code:`download_dataset`. It expects the user to specify the unique
:code:`dataset_id`. It returns a generator. Each iteration then yields
The most useful function is the :code:`download_dataset_parallel`.
Stannislav marked this conversation as resolved.
Show resolved Hide resolved
It expects the user to specify the unique :code:`dataset_id`. It returns a
EmilieDel marked this conversation as resolved.
Show resolved Hide resolved
generator. Each iteration then yields

1. **Image id** (unique identifier)
2. **Coronal section** (a number in [0, 13200])
3. **Original image** (high resolution before registration)
4. **Displacement field** (its shape depends on the :code:`ds_f` downsampling factor)
4. **Displacement field** (its shape depends on the :code:`downsample_ref` downsampling factor)

.. testcode::

from atldld.sync import download_dataset
from atldld.sync import download_dataset_parallel

dataset_id = 909
data_gen = download_dataset(dataset_id, ds_f=25, verbose=False)
data_gen = download_dataset_parallel(dataset_id, downsample_ref=25)

image_id, p, img, df = next(iter(data_gen))
img_reg = df.warp(img)
Expand Down
Loading