Skip to content

Commit

Permalink
Formatted source code with ruff (invesalius#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfmoraes authored Jul 18, 2024
1 parent 817e6fe commit dde0e54
Show file tree
Hide file tree
Showing 102 changed files with 9,240 additions and 8,092 deletions.
260 changes: 128 additions & 132 deletions app.py

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions invesalius/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#--------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas
# Copyright: (C) 2001 Centro de Pesquisas Renato Archer
# Homepage: http://www.softwarepublico.gov.br
# Contact: invesalius@cti.gov.br
# License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt)
#--------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Este programa e software livre; voce pode redistribui-lo e/ou
# modifica-lo sob os termos da Licenca Publica Geral GNU, conforme
# publicada pela Free Software Foundation; de acordo com a versao 2
Expand All @@ -15,4 +15,4 @@
# COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM
# PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais
# detalhes.
#--------------------------------------------------------------------------
# --------------------------------------------------------------------------
6 changes: 3 additions & 3 deletions invesalius/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#--------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas
# Copyright: (C) 2001 Centro de Pesquisas Renato Archer
# Homepage: http://www.softwarepublico.gov.br
# Contact: invesalius@cti.gov.br
# License: GNU - GPL 2 (LICENSE.txt/LICENCA.txt)
#--------------------------------------------------------------------------
# --------------------------------------------------------------------------
# Este programa e software livre; voce pode redistribui-lo e/ou
# modifica-lo sob os termos da Licenca Publica Geral GNU, conforme
# publicada pela Free Software Foundation; de acordo com a versao 2
Expand All @@ -15,4 +15,4 @@
# COMERCIALIZACAO ou de ADEQUACAO A QUALQUER PROPOSITO EM
# PARTICULAR. Consulte a Licenca Publica Geral GNU para obter mais
# detalhes.
#--------------------------------------------------------------------------
# --------------------------------------------------------------------------
26 changes: 15 additions & 11 deletions invesalius/data/actor_factory.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import os
import random

import vtk
import numpy as np
import vtk

from invesalius import inv_paths
import invesalius.data.coordinates as dco
import invesalius.constants as const
import invesalius.data.coordinates as dco
import invesalius.project as prj
from invesalius import inv_paths


class ActorFactory(object):
def __init__(self):
pass

# Utilities

# TODO: This is copied from viewer_volume.py, should be de-duplicated and moved to a single place.
def CreateVTKObjectMatrix(self, position, orientation):
m_img = dco.coordinates_to_transformation_matrix(
position=position,
orientation=orientation,
axes='sxyz',
axes="sxyz",
)
m_img = np.asmatrix(m_img)

Expand Down Expand Up @@ -137,7 +137,7 @@ def CreatePointer(self):
image spacing values.
"""
vtk_colors = vtk.vtkNamedColors()
color = vtk_colors.GetColor3d('DarkRed')
color = vtk_colors.GetColor3d("DarkRed")

scale = 2.0
proj = prj.Project()
Expand All @@ -154,13 +154,15 @@ def CreatePointer(self):
pointer_actor.SetMapper(mapper)
pointer_actor.GetProperty().SetColor(color)
pointer_actor.PickableOff()

return pointer_actor

def CreateArrowUsingDirection(self, position, orientation, colour=[0.0, 0.0, 1.0], length_multiplier=1.0):
def CreateArrowUsingDirection(
self, position, orientation, colour=[0.0, 0.0, 1.0], length_multiplier=1.0
):
"""
Return an actor representing an arrow with the given position and orientation.
The zero angle of the arrow is in the positive x-direction (right in RAS+ coordinate system,
which the volume viewer uses). Note that it corresponds to the anterior of the coil, as the
coil has a coordinate system where x-axis is the anterior-posterior axis.
Expand Down Expand Up @@ -206,7 +208,9 @@ def CreateArrowUsingDirection(self, position, orientation, colour=[0.0, 0.0, 1.0

return actor

def CreateAim(self, position, orientation, colour=[1.0, 1.0, 0.0], scale=1.0, highlight_zero_angle=True):
def CreateAim(
self, position, orientation, colour=[1.0, 1.0, 0.0], scale=1.0, highlight_zero_angle=True
):
"""
Create the aim (crosshair) actor.
Expand Down Expand Up @@ -247,7 +251,7 @@ def CreateAim(self, position, orientation, colour=[1.0, 1.0, 0.0], scale=1.0, hi
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().SetDiffuseColor(colour)
actor.GetProperty().SetSpecular(.2)
actor.GetProperty().SetSpecular(0.2)
actor.GetProperty().SetSpecularPower(100)
actor.GetProperty().SetOpacity(const.AIM_ACTOR_SHOWN_OPACITY)
actor.SetUserTransform(transform)
Expand Down
Loading

0 comments on commit dde0e54

Please sign in to comment.