Skip to content

Commit

Permalink
ENH:Updating formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aylward committed May 4, 2024
1 parent cd712df commit ca09964
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 125 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/auto-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:
ref: ${{ github.head_ref }}
- uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: "3.11"
- uses: psf/black@stable
with:
use_pyproject: true
- uses: chartboost/ruff-action@v1
with:
args: 'check --fix --config pyproject.toml ./src'
args: "check --fix --config pyproject.toml ./src"
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit-message: 'STYLE:Fixes by auto-format'
commit-message: "STYLE:Fixes by auto-format"
5 changes: 2 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ repos:
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: double-quote-string-fixer
- repo: https://github.com/python/black.git
rev: 22.10.0
rev: 24.4.2
hooks:
- id: black
language_version: python3
Expand All @@ -30,4 +29,4 @@ repos:
hooks:
- id: prettier
stages: [commit]
exclude: ["src/ui_*", "*.md"]
exclude: "ui_.*|.*md|.*ui"
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ minder3d = "minder3d.main:main"
develop = [
'black==24.4.2',
'pylint',
'flake8'
'flake8',
'pre-commit',
]

[tool.setuptools.packages.find]
Expand All @@ -40,13 +41,12 @@ readme = {file = ["README.md"]}

[tool.black]
line-length = 80
skip-string-normalization = 1
skip-string-normalization = true
target_version = ['py311']
required_version = "24.4.2"
include = ["src"]
force-exclude = '''
(
ui_.*|.*\.ui|\.gitignore
ui_.*|.*\.ui|\.gitignore|.*\.yml|.*\.yaml|.*\.toml
)
'''

Expand Down
2 changes: 1 addition & 1 deletion src/minder3d/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.0"
__version__ = '0.9.0'
7 changes: 4 additions & 3 deletions src/minder3d/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ def parse_config() -> argparse.Namespace:
"""

parser = argparse.ArgumentParser(
description="Enabling innovative AI for medical imaging.")
description='Enabling innovative AI for medical imaging.'
)

parser.add_argument(
"--load-image", type=str, required=False, help="Path to image"
'--load-image', type=str, required=False, help='Path to image'
)
parser.add_argument(
"--load-scene", type=str, required=False, help="Path to scene"
'--load-scene', type=str, required=False, help='Path to scene'
)

args = parser.parse_args()
Expand Down
1 change: 1 addition & 0 deletions src/minder3d/lib/sovImageTablePanelWidget.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""This module provides the ImageTablePanelWidget class."""

from PySide6.QtCore import QSize
from PySide6.QtGui import QIcon, QPixmap
from PySide6.QtWidgets import (
Expand Down
32 changes: 16 additions & 16 deletions src/minder3d/lib/sovView2DPanelWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,12 @@ def update_image(self):
irange = imax - imin

auto_range = np.quantile(self.state.image_array[-1], [0.1, 0.9])
self.state.view2D_intensity_window_min[
self.state.current_image_num
] = auto_range[0]
self.state.view2D_intensity_window_max[
self.state.current_image_num
] = auto_range[1]
self.state.view2D_intensity_window_min[self.state.current_image_num] = (
auto_range[0]
)
self.state.view2D_intensity_window_max[self.state.current_image_num] = (
auto_range[1]
)

self.update_gui = False

Expand Down Expand Up @@ -272,11 +272,11 @@ def update_overlay(self):
self.state.image[self.state.current_image_num],
self.state.overlay_array[self.state.current_image_num],
)
self.state.overlay[
self.state.current_image_num
] = itk.GetImageFromArray(
self.state.overlay_array[self.state.current_image_num],
ttype=self.state.overlay_type,
self.state.overlay[self.state.current_image_num] = (
itk.GetImageFromArray(
self.state.overlay_array[self.state.current_image_num],
ttype=self.state.overlay_type,
)
)
self.state.overlay[self.state.current_image_num].CopyInformation(
self.state.image[self.state.current_image_num]
Expand Down Expand Up @@ -366,11 +366,11 @@ def redraw_object(self, so):
self.state.image[self.state.current_image_num],
self.state.overlay_array[self.state.current_image_num],
)
self.state.overlay[
self.state.current_image_num
] = itk.GetImageFromArray(
self.state.overlay_array[self.state.current_image_num],
ttype=self.state.overlay_type,
self.state.overlay[self.state.current_image_num] = (
itk.GetImageFromArray(
self.state.overlay_array[self.state.current_image_num],
ttype=self.state.overlay_type,
)
)
self.state.overlay[self.state.current_image_num].CopyInformation(
self.state.image[self.state.current_image_num]
Expand Down
12 changes: 6 additions & 6 deletions src/minder3d/lib/sovView2DRenderWindowInteractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ def reset_camera(self):

@time_and_log
def update_image(self):
self.state.view2D_intensity_window_min[
self.state.current_image_num
] = self.state.image_min[self.state.current_image_num]
self.state.view2D_intensity_window_max[
self.state.current_image_num
] = self.state.image_max[self.state.current_image_num]
self.state.view2D_intensity_window_min[self.state.current_image_num] = (
self.state.image_min[self.state.current_image_num]
)
self.state.view2D_intensity_window_max[self.state.current_image_num] = (
self.state.image_max[self.state.current_image_num]
)
if self.view2D is None:
self.view2D = vtk.vtkImageViewer2()
self.view2D.SetupInteractor(self)
Expand Down
4 changes: 3 additions & 1 deletion src/minder3d/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .config import parse_config
from .minder3DWindow import Minder3DWindow


def main():
"""
Application entrypoint.
Expand Down Expand Up @@ -56,5 +57,6 @@ def main():

app.exec()

if __name__ == "__main__":

if __name__ == '__main__':
main()
1 change: 1 addition & 0 deletions src/minder3d/minder3DState.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The global state of the Minder3D application."""

import logging

import itk
Expand Down
2 changes: 1 addition & 1 deletion src/minder3d/minder3DWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import vtk
from PySide6.QtWidgets import QFileDialog, QInputDialog, QMainWindow, QTabBar

from .minder3DState import Minder3DState
from .lib.sovColorMapUtils import get_nearest_color_index_and_name
from .lib.sovImageTablePanelUtils import get_qthumbnail_from_array
from .lib.sovImageTablePanelWidget import ImageTablePanelWidget
Expand All @@ -25,6 +24,7 @@
from .lib.sovView3DPanelWidget import View3DPanelWidget
from .lib.sovVisualizationPanelWidget import VisualizationPanelWidget
from .lib.sovWelcomePanelWidget import WelcomePanelWidget
from .minder3DState import Minder3DState
from .ui_minder3DWindow import Ui_MainWindow


Expand Down
Loading

0 comments on commit ca09964

Please sign in to comment.