Skip to content

Commit

Permalink
Reference Manual 20230907
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdaniel654 committed Sep 7, 2023
1 parent 391ac92 commit 3b2d19e
Show file tree
Hide file tree
Showing 30 changed files with 6,739 additions and 1,182 deletions.
419 changes: 401 additions & 18 deletions data/fetch.html

Large diffs are not rendered by default.

160 changes: 160 additions & 0 deletions data/tests/test_fetch.html
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,23 @@ <h1 class="title">Module <code>ukat.data.tests.test_fetch</code></h1>
assert len(np.shape(image)) == 3
assert np.shape(affine) == (4, 4)

def test_ge_t2(self):
# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_ge()

# Check the format of the outputs
assert isinstance(magnitude, np.ndarray)
assert np.unique(np.isnan(magnitude)) != [True]
assert isinstance(affine, np.ndarray)
assert isinstance(echo_times, np.ndarray)
assert len(np.shape(magnitude)) == 4
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# If an incorrect dataset_id is given
with pytest.raises(ValueError):
magnitude, affine, echo_times = fetch.t2_ge(2)

def test_philips_t2(self):
# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_philips(1)
Expand All @@ -284,10 +301,39 @@ <h1 class="title">Module <code>ukat.data.tests.test_fetch</code></h1>
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_philips(2)

# Check the format of the outputs
assert isinstance(magnitude, np.ndarray)
assert np.unique(np.isnan(magnitude)) != [True]
assert isinstance(affine, np.ndarray)
assert isinstance(echo_times, np.ndarray)
assert len(np.shape(magnitude)) == 4
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# If an incorrect dataset_id is given
with pytest.raises(ValueError):
magnitude, affine, echo_times = fetch.t2_philips(3)

def test_siemens_t2(self):
# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_siemens()

# Check the format of the outputs
assert isinstance(magnitude, np.ndarray)
assert np.unique(np.isnan(magnitude)) != [True]
assert isinstance(affine, np.ndarray)
assert isinstance(echo_times, np.ndarray)
assert len(np.shape(magnitude)) == 4
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# If an incorrect dataset_id is given
with pytest.raises(ValueError):
magnitude, affine, echo_times = fetch.t2_siemens(2)

def test_ge_t2star(self):
# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2star_ge()
Expand Down Expand Up @@ -617,6 +663,23 @@ <h2 class="section-title" id="header-classes">Classes</h2>
assert len(np.shape(image)) == 3
assert np.shape(affine) == (4, 4)

def test_ge_t2(self):
# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_ge()

# Check the format of the outputs
assert isinstance(magnitude, np.ndarray)
assert np.unique(np.isnan(magnitude)) != [True]
assert isinstance(affine, np.ndarray)
assert isinstance(echo_times, np.ndarray)
assert len(np.shape(magnitude)) == 4
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# If an incorrect dataset_id is given
with pytest.raises(ValueError):
magnitude, affine, echo_times = fetch.t2_ge(2)

def test_philips_t2(self):
# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_philips(1)
Expand All @@ -630,10 +693,39 @@ <h2 class="section-title" id="header-classes">Classes</h2>
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_philips(2)

# Check the format of the outputs
assert isinstance(magnitude, np.ndarray)
assert np.unique(np.isnan(magnitude)) != [True]
assert isinstance(affine, np.ndarray)
assert isinstance(echo_times, np.ndarray)
assert len(np.shape(magnitude)) == 4
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# If an incorrect dataset_id is given
with pytest.raises(ValueError):
magnitude, affine, echo_times = fetch.t2_philips(3)

def test_siemens_t2(self):
# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_siemens()

# Check the format of the outputs
assert isinstance(magnitude, np.ndarray)
assert np.unique(np.isnan(magnitude)) != [True]
assert isinstance(affine, np.ndarray)
assert isinstance(echo_times, np.ndarray)
assert len(np.shape(magnitude)) == 4
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# If an incorrect dataset_id is given
with pytest.raises(ValueError):
magnitude, affine, echo_times = fetch.t2_siemens(2)

def test_ge_t2star(self):
# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2star_ge()
Expand Down Expand Up @@ -759,6 +851,33 @@ <h3>Methods</h3>
assert (np.shape(bvecs)[0] == 3 or np.shape(bvecs)[1] == 3)</code></pre>
</details>
</dd>
<dt id="ukat.data.tests.test_fetch.TestFetch.test_ge_t2"><code class="name flex">
<span>def <span class="ident">test_ge_t2</span></span>(<span>self)</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def test_ge_t2(self):
# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_ge()

# Check the format of the outputs
assert isinstance(magnitude, np.ndarray)
assert np.unique(np.isnan(magnitude)) != [True]
assert isinstance(affine, np.ndarray)
assert isinstance(echo_times, np.ndarray)
assert len(np.shape(magnitude)) == 4
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# If an incorrect dataset_id is given
with pytest.raises(ValueError):
magnitude, affine, echo_times = fetch.t2_ge(2)</code></pre>
</details>
</dd>
<dt id="ukat.data.tests.test_fetch.TestFetch.test_ge_t2star"><code class="name flex">
<span>def <span class="ident">test_ge_t2star</span></span>(<span>self)</span>
</code></dt>
Expand Down Expand Up @@ -1034,6 +1153,18 @@ <h3>Methods</h3>
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_philips(2)

# Check the format of the outputs
assert isinstance(magnitude, np.ndarray)
assert np.unique(np.isnan(magnitude)) != [True]
assert isinstance(affine, np.ndarray)
assert isinstance(echo_times, np.ndarray)
assert len(np.shape(magnitude)) == 4
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# If an incorrect dataset_id is given
with pytest.raises(ValueError):
magnitude, affine, echo_times = fetch.t2_philips(3)</code></pre>
Expand Down Expand Up @@ -1189,6 +1320,33 @@ <h3>Methods</h3>
assert (np.shape(bvecs)[0] == 3 or np.shape(bvecs)[1] == 3)</code></pre>
</details>
</dd>
<dt id="ukat.data.tests.test_fetch.TestFetch.test_siemens_t2"><code class="name flex">
<span>def <span class="ident">test_siemens_t2</span></span>(<span>self)</span>
</code></dt>
<dd>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def test_siemens_t2(self):
# Test if the fetch function works
magnitude, affine, echo_times = fetch.t2_siemens()

# Check the format of the outputs
assert isinstance(magnitude, np.ndarray)
assert np.unique(np.isnan(magnitude)) != [True]
assert isinstance(affine, np.ndarray)
assert isinstance(echo_times, np.ndarray)
assert len(np.shape(magnitude)) == 4
assert np.shape(affine) == (4, 4)
assert len(np.shape(echo_times)) == 1

# If an incorrect dataset_id is given
with pytest.raises(ValueError):
magnitude, affine, echo_times = fetch.t2_siemens(2)</code></pre>
</details>
</dd>
<dt id="ukat.data.tests.test_fetch.TestFetch.test_siemens_t2star"><code class="name flex">
<span>def <span class="ident">test_siemens_t2star</span></span>(<span>self)</span>
</code></dt>
Expand Down Expand Up @@ -1235,6 +1393,7 @@ <h4><code><a title="ukat.data.tests.test_fetch.TestFetch" href="#ukat.data.tests
<ul class="">
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_ge_b0" href="#ukat.data.tests.test_fetch.TestFetch.test_ge_b0">test_ge_b0</a></code></li>
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_ge_dwi" href="#ukat.data.tests.test_fetch.TestFetch.test_ge_dwi">test_ge_dwi</a></code></li>
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_ge_t2" href="#ukat.data.tests.test_fetch.TestFetch.test_ge_t2">test_ge_t2</a></code></li>
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_ge_t2star" href="#ukat.data.tests.test_fetch.TestFetch.test_ge_t2star">test_ge_t2star</a></code></li>
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_philips_b0" href="#ukat.data.tests.test_fetch.TestFetch.test_philips_b0">test_philips_b0</a></code></li>
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_philips_dwi" href="#ukat.data.tests.test_fetch.TestFetch.test_philips_dwi">test_philips_dwi</a></code></li>
Expand All @@ -1250,6 +1409,7 @@ <h4><code><a title="ukat.data.tests.test_fetch.TestFetch" href="#ukat.data.tests
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_philips_tsnr" href="#ukat.data.tests.test_fetch.TestFetch.test_philips_tsnr">test_philips_tsnr</a></code></li>
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_siemens_b0" href="#ukat.data.tests.test_fetch.TestFetch.test_siemens_b0">test_siemens_b0</a></code></li>
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_siemens_dwi" href="#ukat.data.tests.test_fetch.TestFetch.test_siemens_dwi">test_siemens_dwi</a></code></li>
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_siemens_t2" href="#ukat.data.tests.test_fetch.TestFetch.test_siemens_t2">test_siemens_t2</a></code></li>
<li><code><a title="ukat.data.tests.test_fetch.TestFetch.test_siemens_t2star" href="#ukat.data.tests.test_fetch.TestFetch.test_siemens_t2star">test_siemens_t2star</a></code></li>
</ul>
</li>
Expand Down
4 changes: 2 additions & 2 deletions mapping/b0.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ <h1 class="title">Module <code>ukat.mapping.b0</code></h1>
# B0 Map Offset Correction
self.b0_map -= (np.round(mean_central_b0 / b0_offset_step)) * \
b0_offset_step

# Mask B0 Map
self.b0_map[np.squeeze(~self.mask)] = 0
else:
Expand Down Expand Up @@ -370,7 +370,7 @@ <h2 id="parameters">Parameters</h2>
# B0 Map Offset Correction
self.b0_map -= (np.round(mean_central_b0 / b0_offset_step)) * \
b0_offset_step

# Mask B0 Map
self.b0_map[np.squeeze(~self.mask)] = 0
else:
Expand Down
Loading

0 comments on commit 3b2d19e

Please sign in to comment.