-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
# Conflicts: # docs/conf.py # eyepy/io/__init__.py # eyepy/io/base.py # eyepy/io/he_vol.py
- Loading branch information
Showing
34 changed files
with
661 additions
and
2,073 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
minimum_pre_commit_version: 1.20.0 | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-added-large-files | ||
- id: requirements-txt-fixer | ||
- id: fix-encoding-pragma | ||
- id: check-added-large-files | ||
- id: check-docstring-first | ||
- repo: https://github.com/asottile/blacken-docs | ||
rev: v1.3.0 | ||
hooks: | ||
- id: blacken-docs | ||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: v1.4.2 | ||
hooks: | ||
- id: python-use-type-annotations | ||
- repo: https://github.com/myint/docformatter | ||
rev: v1.3.1 | ||
hooks: | ||
- id: docformatter | ||
- repo: https://github.com/pre-commit/mirrors-isort | ||
rev: v4.3.21 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/psf/black | ||
rev: 19.10b0 | ||
hooks: | ||
- id: black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
======== | ||
Examples | ||
======== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
examples/rigid_registration |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ Usage | |
|
||
To use eyepy in a project:: | ||
|
||
import eyepy | ||
import eyepy as ep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
from .he_vol import HeyexOct, read_vol |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,76 @@ | ||
import untangle | ||
# -*- coding: utf-8 -*- | ||
import numpy as np | ||
import untangle | ||
|
||
|
||
class SpectralisXMLReader(object): | ||
def __init__(self, path): | ||
self.obj = untangle.parse(path) | ||
|
||
@property | ||
def version(self): | ||
self.obj.HEDX.BODY.SWVersion.Version.cdata | ||
|
||
@property | ||
def octs(self): | ||
images = self.obj.HEDX.BODY.Patient.Study.Series.Image | ||
return [i for i in images if i.ImageType.Type == 'OCT'] | ||
return [i for i in images if i.ImageType.Type == "OCT"] | ||
|
||
@property | ||
def oct_filenames(self): | ||
octs = self.octs | ||
return self.get_oct_filenames(octs) | ||
|
||
@property | ||
def localizer_filename(self): | ||
return self.get_localizer_filename() | ||
|
||
@property | ||
def oct_width(self): | ||
return int(self.octs[0].OphthalmicAcquisitionContext.Width.cdata) | ||
|
||
@property | ||
def oct_height(self): | ||
return int(self.octs[0].OphthalmicAcquisitionContext.Height.cdata) | ||
|
||
@property | ||
def oct_n(self): | ||
return int(len(self.octs)) | ||
|
||
|
||
def get_segmentations(self): | ||
|
||
self.segmentations = {} | ||
|
||
def get_segmentations(self): | ||
|
||
self.segmentations = {} | ||
seg_types = [x.Name for x in self.octs[0].Segmentation.SegLine] | ||
|
||
for seg_type in seg_types: | ||
self.segmentations[seg_type.cdata] = self.get_segmentation(seg_type.cdata) | ||
|
||
self.segmentations[seg_type.cdata] *= 255 | ||
self.segmentations[seg_type.cdata] = self.segmentations[seg_type.cdata].astype(np.uint8) | ||
self.segmentations[seg_type.cdata] = self.segmentations[ | ||
seg_type.cdata | ||
].astype(np.uint8) | ||
return self.segmentations | ||
|
||
|
||
|
||
def get_segmentation(self, name): | ||
seg = np.zeros((self.oct_n, self.oct_height, self.oct_width)) | ||
for i in range(self.oct_n): | ||
for s in self.octs[i].Segmentation.SegLine: | ||
if s.Name.cdata == name: | ||
seg_data = np.array(s.Array.cdata.split(' ')).astype('float') | ||
seg_data = np.array(s.Array.cdata.split(" ")).astype("float") | ||
x = np.where(seg_data < 10000) | ||
y = np.rint(seg_data[x]).astype(int) | ||
seg[i, y, x] = 1 | ||
#seg = (seg*255).astype(np.uint8) | ||
# seg = (seg*255).astype(np.uint8) | ||
|
||
return seg | ||
|
||
def get_oct_filenames(self, octs): | ||
names = [] | ||
for o in octs: | ||
names.append(o.ImageData.ExamURL.cdata.split('\\')[-1]) | ||
names.append(o.ImageData.ExamURL.cdata.split("\\")[-1]) | ||
return names | ||
|
||
def get_localizer_filename(self): | ||
images = self.obj.HEDX.BODY.Patient.Study.Series.Image | ||
path = [i for i in images if i.ImageType.Type == 'LOCALIZER'][0] | ||
return path.ImageData.ExamURL.cdata.split('\\')[-1] | ||
path = [i for i in images if i.ImageType.Type == "LOCALIZER"][0] | ||
return path.ImageData.ExamURL.cdata.split("\\")[-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
from .loggabor import mean_phase | ||
|
||
|
||
def center_crop(img, size): | ||
center = img.shape[0] // 2, img.shape[1] // 2 | ||
|
||
height_range = center[0] - size[0] // 2, center[0] + size[0] // 2 | ||
width_range = center[1] - size[1] // 2, center[1] + size[1] // 2 | ||
return img[height_range[0] : height_range[1], width_range[0] : width_range[1], :] |
Oops, something went wrong.