Skip to content

Commit

Permalink
ENH:Renaming application to Minder3D and packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
aylward committed May 4, 2024
1 parent f3c496b commit 5fc42a0
Show file tree
Hide file tree
Showing 68 changed files with 210 additions and 107 deletions.
2 changes: 0 additions & 2 deletions .commitlintrc.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
build
*egg-info
experiments
venv*
archive
__pycache__
*.swp
*~
*.zip
4 changes: 0 additions & 4 deletions .isort.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ repos:
hooks:
- id: prettier
stages: [commit]
exclude: "src/ui_*"
exclude: ["src/ui_*", "*.md"]
1 change: 0 additions & 1 deletion .pylintrc

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# pytubeview
# Minder3D

Analyze and visualize vessels in 3D
Using AI to foster innovation in the exploration of radiological images.
9 changes: 5 additions & 4 deletions README_Dev.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
QT Designer was used to define the layout:
qt6-tools.exe designer pytubeview.ui
Prior to making a commit, please verify your code is compliant:
pre-commit run --all-files

Then view the python code and same to
ui_pytubeview.py
QT Designer was used to define the layout. On Windows, to launch
designer, use this command:
qt6-tools.exe designer pytubeview.ui
68 changes: 66 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,73 @@
# Python
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "minder3d"
description = "Using AI to foster innovation in the exploration of radiological images."
license = {text = "Apache 2.0"}
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Python :: 3"
]
dynamic = ["version", "readme"]

dependencies = [
'PyQt6',
'PySide6',
'numpy',
'vtk',
#'itk', # Do not install until ITK pypi is updated
]

[project.scripts]

minder3d = "minder3d.main:main"

[project.optional-dependencies]

develop = [
'black',
'pylint',
'flake8'
]

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.dynamic]
version = {attr = "minder3d.__version__"}
readme = {file = ["README.md"]}

[tool.black]
line-length = 80
skip-string-normalization = 1
target_version = ["py311"]
target_version = ['py311']
exclude = '''
(
/(
\.eggs # exclude a few common directories in the
| \.git # root of the project
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| build
| dist
)/
| .gitignore
)
'''

[tool.flake8]
max-line-length = 80
extend-ignore = ["E501"]

[tool.isort]
profile = "black"
skip_glob = "src/ui_*"
line_length = 80

[tool.pylint]
max-line-length = 80
4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

1 change: 1 addition & 0 deletions src/minder3d/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.9.0"
28 changes: 28 additions & 0 deletions src/minder3d/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3

"""
Helper utility to parse input parameters for a given run.
"""

import argparse


def parse_config() -> argparse.Namespace:
"""
Parse command line arguments to configure the run.
"""

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

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

args = parser.parse_args()
print(args)

return args
Empty file added src/minder3d/lib/__init__.py
Empty file.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QWidget

from ui_sovChatPanelWidget import Ui_ChatPanelWidget
from .ui_sovChatPanelWidget import Ui_ChatPanelWidget


class ChatPanelWidget(QWidget, Ui_ChatPanelWidget):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from PySide6.QtWidgets import QWidget

from sovImageProcessLogic import ImageProcessLogic
from sovUtils import time_and_log
from ui_sovImageProcessPanelWidget import Ui_ImageProcessPanelWidget
from .sovImageProcessLogic import ImageProcessLogic
from .sovUtils import time_and_log
from .ui_sovImageProcessPanelWidget import Ui_ImageProcessPanelWidget


class ImageProcessPanelWidget(QWidget, Ui_ImageProcessPanelWidget):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"""This module provides the ImageTablePanelWidget class."""
from PySide6.QtCore import QSize
from PySide6.QtGui import QIcon, QPixmap
from PySide6.QtWidgets import (
Expand All @@ -7,9 +8,9 @@
QWidget,
)

from sovImageTablePanelUtils import get_qthumbnail_from_array
from sovUtils import get_file_reccords_from_settings, time_and_log
from ui_sovImageTablePanelWidget import Ui_ImageTablePanelWidget
from .sovImageTablePanelUtils import get_qthumbnail_from_array
from .sovUtils import get_file_reccords_from_settings, time_and_log
from .ui_sovImageTablePanelWidget import Ui_ImageTablePanelWidget


class ImageTablePanelWidget(QWidget, Ui_ImageTablePanelWidget):
Expand Down Expand Up @@ -60,7 +61,8 @@ def update_image(self):
def redraw_image(self, img_num):
"""Redraws the image at the specified index in the image table widget.
This function updates the information displayed in the image table widget for the image at the specified index.
This function updates the information displayed in the image table
widget for the image at the specified index.
Args:
self: The object instance.
Expand Down Expand Up @@ -102,11 +104,13 @@ def redraw_image(self, img_num):

@time_and_log
def fill_table(self):
"""Fill the image table with image records from the state and file records from settings.
"""Fill the image table with images from the state and from settings.
This method clears the existing image table and fills it with image records from the state. It then retrieves file
records from the settings and adds them to the table if they are not already present. For each file record, it
populates the table with the file's thumbnail, filename, size, and spacing.
This method clears the existing image table and fills it with image
records from the state. It then retrieves file records from the
settings and adds them to the table if they are not already present.
For each file record, it populates the table with the file's thumbnail,
filename, size, and spacing.
Args:
self: The instance of the class.
Expand All @@ -131,13 +135,13 @@ def fill_table(self):
self.imageTableWidget.setItem(
img_num, 2, QTableWidgetItem(file.filename)
)
if type(file.file_size) == type([]) and len(file.file_size) > 0:
if type(file.file_size) is type([]) and len(file.file_size) > 0:
size_str = [str(i) for i in file.file_size]
self.imageTableWidget.setItem(
img_num, 3, QTableWidgetItem('x'.join(size_str))
)
if (
type(file.file_spacing) == type([])
type(file.file_spacing) is type([])
and len(file.file_spacing) > 0
):
spacing_str = [f'{i:.4f}' for i in file.file_spacing]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
QWidget,
)

from sovUtils import time_and_log
from ui_sovInfoTablePanelWidget import Ui_InfoTablePanelWidget
from .sovUtils import time_and_log
from .ui_sovInfoTablePanelWidget import Ui_InfoTablePanelWidget


class InfoTablePanelWidget(QWidget, Ui_InfoTablePanelWidget):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import itk
import numpy as np

from sovImageProcessLogic import ImageProcessLogic
from sovUtils import time_and_log
from .sovImageProcessLogic import ImageProcessLogic
from .sovUtils import time_and_log


class LungCTALogic:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from PySide6.QtGui import QCloseEvent
from PySide6.QtWidgets import QMessageBox, QWidget

from sovLungCTALogic import LungCTALogic
from sovUtils import add_objects_in_mask_image_to_scene, time_and_log
from ui_sovLungCTAPanelWidget import Ui_LungCTAPanelWidget
from .sovLungCTALogic import LungCTALogic
from .sovUtils import add_objects_in_mask_image_to_scene, time_and_log
from .ui_sovLungCTAPanelWidget import Ui_LungCTAPanelWidget


class LungCTAPanelWidget(QWidget, Ui_LungCTAPanelWidget):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from PySide6.QtWidgets import QWidget

from sovImageProcessPanelWidget import ImageProcessPanelWidget
from sovLungCTAPanelWidget import LungCTAPanelWidget
from sovOtsuPanelWidget import OtsuPanelWidget
from sovUtils import time_and_log
from ui_sovNewTaskPanelWidget import Ui_NewTaskPanelWidget
from .sovImageProcessPanelWidget import ImageProcessPanelWidget
from .sovLungCTAPanelWidget import LungCTAPanelWidget
from .sovOtsuPanelWidget import OtsuPanelWidget
from .sovUtils import time_and_log
from .ui_sovNewTaskPanelWidget import Ui_NewTaskPanelWidget


class NewTaskPanelWidget(QWidget, Ui_NewTaskPanelWidget):
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from PySide6.QtGui import QCloseEvent
from PySide6.QtWidgets import QWidget

from sovOtsuLogic import OtsuLogic
from sovUtils import add_objects_in_mask_image_to_scene, time_and_log
from ui_sovOtsuPanelWidget import Ui_OtsuPanelWidget
from .sovOtsuLogic import OtsuLogic
from .sovUtils import add_objects_in_mask_image_to_scene, time_and_log
from .ui_sovOtsuPanelWidget import Ui_OtsuPanelWidget


class OtsuPanelWidget(QWidget, Ui_OtsuPanelWidget):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QWidget

from ui_sovScreenCapturePanelWidget import Ui_ScreenCapturePanelWidget
from .ui_sovScreenCapturePanelWidget import Ui_ScreenCapturePanelWidget


class ScreenCapturePanelWidget(QWidget, Ui_ScreenCapturePanelWidget):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QWidget

from ui_sovPreProcessPanelWidget import Ui_PreProcessPanelWidget
from .ui_sovPreProcessPanelWidget import Ui_PreProcessPanelWidget


class PreProcessPanelWidget(QWidget, Ui_PreProcessPanelWidget):
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/sovUtils.py → src/minder3d/lib/sovUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from PySide6.QtCore import QSettings, QStandardPaths
from PySide6.QtWidgets import QMainWindow, QTextEdit

from sovColorMapUtils import short_colormap, short_colormap_scale_factor
from .sovColorMapUtils import short_colormap, short_colormap_scale_factor

logging.basicConfig(level=logging.DEBUG)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
import numpy as np
from PySide6.QtWidgets import QWidget

from sovUtils import time_and_log
from sovView2DRenderWindowInteractor import View2DRenderWindowInteractor
from sovView2DUtils import (
from .sovUtils import time_and_log
from .sovView2DRenderWindowInteractor import View2DRenderWindowInteractor
from .sovView2DUtils import (
render_object_in_overlay_array,
render_scene_in_overlay_array,
)
from ui_sovView2DPanelWidget import Ui_View2DPanelWidget
from .ui_sovView2DPanelWidget import Ui_View2DPanelWidget


class View2DPanelWidget(QWidget, Ui_View2DPanelWidget):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
from vtk.util.numpy_support import numpy_to_vtk

from sovUtils import time_and_log
from .sovUtils import time_and_log


class View2DRenderWindowInteractor(QVTKRenderWindowInteractor):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import itk
import numpy as np

from sovUtils import get_children_as_list, time_and_log
from .sovUtils import get_children_as_list, time_and_log


@time_and_log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from PySide6.QtWidgets import QWidget

from sovUtils import time_and_log
from sovView3DRenderWindowInteractor import View3DRenderWindowInteractor
from ui_sovView3DPanelWidget import Ui_View3DPanelWidget
from .sovUtils import time_and_log
from .sovView3DRenderWindowInteractor import View3DRenderWindowInteractor
from .ui_sovView3DPanelWidget import Ui_View3DPanelWidget


class View3DPanelWidget(QWidget, Ui_View3DPanelWidget):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
vtkRenderer,
)

from sovUtils import get_tag_value_index_in_list_of_dict, time_and_log
from sovView3DUtils import (
from .sovUtils import get_tag_value_index_in_list_of_dict, time_and_log
from .sovView3DUtils import (
convert_scene_to_surfaces,
get_closest_point_in_world_space,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from vtkmodules.vtkCommonDataModel import vtkCellArray, vtkPolyData, vtkPolyLine
from vtkmodules.vtkFiltersCore import vtkSurfaceNets3D, vtkTubeFilter

from sovUtils import get_children_as_list, time_and_log
from .sovUtils import get_children_as_list, time_and_log


@time_and_log
Expand Down
Loading

0 comments on commit 5fc42a0

Please sign in to comment.