Skip to content

Commit

Permalink
Updating docs structure
Browse files Browse the repository at this point in the history
  • Loading branch information
mcencini committed Jan 18, 2024
1 parent 2bfd9d7 commit dcf44d7
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 18 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 6 additions & 4 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
```{include} ../../_README.md
```

<!---
```{toctree}
:hidden:
:caption: User Guide
Expand All @@ -10,7 +11,9 @@ user_guide/getting_started.md
user_guide/overview.md
```
-->

<!---
```{toctree}
:hidden:
:maxdepth: 2
Expand All @@ -21,14 +24,13 @@ tutorials/01-warmup-mri-recon.ipynb
tutorials/02-dl-mri-recon.ipynb
```
-->

```{toctree}
:hidden:
:caption: API References
:caption: Core Modules
api/io.md
api/optim.md
api/prox.md
core/io.md
```

Expand Down
4 changes: 2 additions & 2 deletions src/deepmr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from importlib.metadata import version
__version__ = version("deepmr")

from . import bloch
# from . import bloch
from . import io
from . import optim
# from . import optim
# from . import prox

from .testdata import testdata
17 changes: 9 additions & 8 deletions src/deepmr/io/image/dicom.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
__all__ = ["read_dicom"]

import glob
import math
import multiprocessing
import os
from multiprocessing.dummy import Pool as ThreadPool
Expand Down Expand Up @@ -251,8 +252,8 @@ def _cast_to_complex_ge(dsets_in):
do_recon = False

if magnitude and phase and do_recon:
scale = 2 * np.pi / 4095
offset = -np.pi
scale = 2 * math.pi / 4095
offset = -math.pi
img = np.stack(magnitude, axis=0).astype(np.float32) * np.exp(
1j * (scale * np.stack(phase, axis=0) + offset).astype(np.float32)
)
Expand All @@ -264,8 +265,8 @@ def _cast_to_complex_ge(dsets_in):
if np.iscomplexobj(img):
phase = np.angle(img)
phase[..., 1::2, :, :] = (
(1e5 * (phase[..., 1::2, :, :] + 2 * np.pi)) % (2 * np.pi * 1e5)
) / 1e5 - np.pi
(1e5 * (phase[..., 1::2, :, :] + 2 * math.pi)) % (2 * math.pi * 1e5)
) / 1e5 - math.pi
img = np.abs(img) * np.exp(1j * phase)

# count number of instances
Expand Down Expand Up @@ -302,8 +303,8 @@ def _cast_to_complex_philips(dsets_in):
phase.append(dset.pixel_array)

if magnitude and phase:
scale = 2 * np.pi / 4095
offset = -np.pi
scale = 2 * math.pi / 4095
offset = -math.pi
img = np.stack(magnitude, axis=0).astype(np.float32) * np.exp(
1j * (scale * np.stack(phase, axis=0) + offset).astype(np.float32)
)
Expand Down Expand Up @@ -342,8 +343,8 @@ def _cast_to_complex_siemens(dsets_in):
phase.append(dset.pixel_array)

if magnitude and phase:
scale = 2 * np.pi / 4095
offset = -np.pi
scale = 2 * math.pi / 4095
offset = -math.pi
img = np.stack(magnitude, axis=0).astype(np.float32) * np.exp(
1j * (scale * np.stack(phase, axis=0) + offset).astype(np.float32)
)
Expand Down
8 changes: 4 additions & 4 deletions src/deepmr/io/image/nifti.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

__all__ = ["read_nifti"]

# import copy
import glob
import json
import math
import os

import numpy as np
Expand Down Expand Up @@ -102,8 +102,8 @@ def _nifti_read(file_path, json_dict):

# cast to complex image
if data_phase.size != 0:
scale = 2 * np.pi / 4095
offset = -np.pi
scale = 2 * math.pi / 4095
offset = -math.pi
data = data * np.exp(1j * scale * data_phase + offset)
if data_real.size != 0 and data_imag.size != 0:
data = data_real + 1j * data_imag
Expand All @@ -118,7 +118,7 @@ def _nifti_read(file_path, json_dict):
# fix fftshift along z
if np.iscomplexobj(data) and json_dict['Manufacturer'] == 'GE':
phase = np.angle(data)
phase[..., 1::2, :, :] = ((1e5 * (phase[..., 1::2, :, :] + 2 * np.pi)) % (2 * np.pi * 1e5)) / 1e5 - np.pi
phase[..., 1::2, :, :] = ((1e5 * (phase[..., 1::2, :, :] + 2 * math.pi)) % (2 * math.pi * 1e5)) / 1e5 - math.pi
data = np.abs(data) * np.exp(1j * phase)

return np.ascontiguousarray(data.transpose()), head, affine
Expand Down

0 comments on commit dcf44d7

Please sign in to comment.