Skip to content

Commit

Permalink
Various small changes (#157)
Browse files Browse the repository at this point in the history
* fix typo

* remove unused code

* reduce duplication

* remove unecessary comment

* remove unecessary comments

* Update pyproject

* update badge

* Remove warning supression
  • Loading branch information
adamltyson authored Dec 18, 2023
1 parent 6208d75 commit fdef40d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 57 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Wheel](https://img.shields.io/pypi/wheel/brainglobe-segmentation.svg)](https://pypi.org/project/brainglobe-segmentation)
[![Development Status](https://img.shields.io/pypi/status/brainglobe-segmentation.svg)](https://github.com/brainglobe/brainglobe-segmentation)
[![Tests](https://img.shields.io/github/workflow/status/brainglobe/brainglobe-segmentation/tests)](https://github.com/brainglobe/brainglobe-segmentation/actions)
[![codecov](https://codecov.io/gh/brainglobe/brainglobe-segmentation/graph/badge.svg)](https://codecov.io/gh/brainglobe/brainglobe-segmentation)
[![codecov](https://codecov.io/gh/brainglobe/brainglobe-segmentation/graph/badge.svg?token=WP9KTPZE5R)](https://codecov.io/gh/brainglobe/brainglobe-segmentation)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)
[![Twitter](https://img.shields.io/twitter/follow/brain_globe?style=social)](https://twitter.com/brain_globe)

Expand Down
2 changes: 1 addition & 1 deletion brainglobe_segmentation/image/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

def create_KDTree_from_image(image, value=0):
"""
Create a KDTree of points equalling a given value
Create a KDTree of points equaling a given value
:param image: Image to be converted to points
:param value: Value of image to be used
:return: scipy.spatial.cKDTree object
Expand Down
6 changes: 0 additions & 6 deletions brainglobe_segmentation/layout/gui_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,3 @@
IMAGE_FILE_EXT = ".tiff"
BOUNDARIES_STRING = "Boundaries"
HEMISPHERES_STRING = "Hemispheres"

# ORIENTATIONS = [
# "asl",
# "lsa",
# "sla",
# ] # When rolling through orientations of the brain, adhere to this order
22 changes: 1 addition & 21 deletions brainglobe_segmentation/regions/IO.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import imio
import numpy as np
from brainglobe_utils.general.pathlib import append_to_pathlib_stem
from brainglobe_utils.IO.surfaces import marching_cubes_to_obj
from skimage import measure


Expand All @@ -26,27 +27,6 @@ def extract_and_save_object(
)


def marching_cubes_to_obj(marching_cubes_out, output_file):
"""
Saves the output of skimage.measure.marching_cubes as an .obj file
:param marching_cubes_out: tuple
:param output_file: str
"""

verts, faces, normals, _ = marching_cubes_out
with open(output_file, "w") as f:
for item in verts:
f.write(f"v {item[0]} {item[1]} {item[2]}\n")
for item in normals:
f.write(f"vn {item[0]} {item[1]} {item[2]}\n")
for item in faces:
f.write(
f"f {item[0]}//{item[0]} {item[1]}//{item[1]} "
f"{item[2]}//{item[2]}\n"
)
f.close()


def volume_to_vector_array_to_obj_file(
image,
output_path,
Expand Down
4 changes: 0 additions & 4 deletions brainglobe_segmentation/segmentation_panels/regions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# RegionSeg
from qtpy.QtWidgets import QGridLayout, QGroupBox

from brainglobe_segmentation.layout.gui_constants import (
Expand Down Expand Up @@ -122,9 +121,6 @@ def add_region_panel(self, row):
self.region_panel.setVisible(False)

def toggle_region_panel(self):
# TODO: Change color scheme directly when theme is switched
# TODO: "text-align" property should follow constant
# SEGM_METHODS_PANEL_ALIGN
if self.region_panel.isVisible():
self.region_panel.setVisible(False)
if self.parent.viewer.theme == "dark":
Expand Down
27 changes: 3 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ classifiers = [
"Framework :: napari",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Operating System :: Microsoft :: Windows :: Windows 10",
"Operating System :: POSIX :: Linux",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
requires-python = ">=3.9"
dependencies = [
Expand Down Expand Up @@ -74,28 +73,8 @@ include = ["brainglobe_segmentation*"]

[tool.setuptools_scm]

[tool.pytest.ini_options]
filterwarnings = [
"error",
# Emitted by scikit-image on import, see https://github.com/scikit-image/scikit-image/issues/6663
# This filter should be removed when scikit-image 0.20 is released
"ignore:`np.bool8` is a deprecated alias for `np.bool_`",
# Emitted by nptyping, see https://github.com/ramonhagenaars/nptyping/issues/102
# for upstream issue
"ignore:`np.object0` is a deprecated alias for ``np.object0`",
"ignore:`np.int0` is a deprecated alias for `np.intp`",
"ignore:`np.uint0` is a deprecated alias for `np.uintp`",
"ignore:`np.void0` is a deprecated alias for `np.void`",
"ignore:`np.bytes0` is a deprecated alias for `np.bytes_`",
"ignore:`np.str0` is a deprecated alias for `np.str_`",
# Warning comes from vispy - fixed in vispy 0.12.0. napari 0.5.0 will bump
# vispy to 0.5.0, so this filter should be removed when napari 0.5.0
# is released
"ignore:distutils Version classes are deprecated:DeprecationWarning",
]

[tool.black]
target-version = ['py38', 'py39', 'py310']
target-version = ['py39', 'py310', 'py311']
skip-string-normalization = false
line-length = 79

Expand Down

0 comments on commit fdef40d

Please sign in to comment.