Beispiel #1
0
 def __init__(self,
              widg2D,
              pts,
              isClosed=False,
              col=color(1, 0, 0, 1),
              etype=None,
              radius=None):
     PolyHandle2D.__init__(self, widg2D, pts, isClosed, col, etype, radius)
     self.label = None
Beispiel #2
0
    def __init__(self, name, mtype, col=(1, 1, 1), timesteps=[], values=[]):
        self.name = name
        self.mtype = mtype
        self.col = color(*col)
        self.timesteps = list(timesteps)
        self.values = [list(itertools.starmap(vec3, v))
                       for v in values]  # list of lists, store values as vec3

        assert len(self.values) == len(self.timesteps)
        assert all(len(v) == len(self.values[0]) for v in self.values)
        assert mtype in MeasureType
# (at your option) any later version.
# 
# Eidolon is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License along
# with this program (LICENSE.txt).  If not, see <http://www.gnu.org/licenses/>

import sys
sys.path.append(scriptdir+'..')
from eidolon import MeshSceneObject,ElemType,vec3,color,ReprType,frange,PyDataSet

mat=mgr.getMaterial('Rainbow')
mat.setSpectrumValue(1,0.005,color(0.0,1.0,1.0,1.0))

trinodes=[vec3(0,0,0),vec3(1,0,0),vec3(0.5,0,1),vec3(1.1,0,0),vec3(2.1,0,0),vec3(1.6,0,1)]
triinds=[(0,1,2),(3,4,5)]
trifield=[1,2,3,4,5,6]
trielemfield=[-1,2]

quadnodes=[vec3(2.2,0,0),vec3(3.2,0,0),vec3(2.2,0,1),vec3(3.2,0,1),vec3(3.3,0,0),vec3(4.3,0,0),vec3(3.3,0,1),vec3(4.3,0,1)]
quadinds=[(6,7,8,9),(10,11,12,13)]
quadfield=[1,2,3,4,5,6,7,8]
quadelemfield=[-1,2]
quadfieldtopo=[(0,1,2,3),(4,5,6,7)] # need a separate topology for quad field since the quad topo doesn't start indexing from 0

nodes=trinodes+quadnodes

nodefield=list(frange(len(nodes)))
Beispiel #4
0
from ui import QtWidgets, QtCore, Qt, Ui_Measure2DView, Ui_MeasureObjProp
from .SegmentPlugin import triangulateContour, generateContoursFromMask
from .PlotPlugin import TimePlotWidget
import itertools

# names of parameters for the measurement data file
DatafileParams = enum('name', 'title', 'srcimage', 'tracksrc', 'trackdata')

# types of measurements
MeasureType = enum('point', 'line', 'contour')

# extension of measurement files
measureExt = '.measure'

defaultNumNodes = 16  # default number of contour nodes
defaultColor = color(1, 0, 0)  # default handle colour

# default colours for points
PointColors = (color(1, 0, 0), color(0, 1, 0), color(0, 0, 1), color(1, 1, 0),
               color(1, 0, 1), color(0, 1, 1), color(1, 1, 1))


def calculateLength(measure, objs):
    return [v[0].distTo(v[1]) for v in measure.values]


def calculateDisplacement(measure, objs):
    return [measure.values[0][0].distTo(v[0]) for v in measure.values]


def calculateCircumference(measure, objs):
Beispiel #5
0
#
# You should have received a copy of the GNU General Public License along
# with this program (LICENSE.txt).  If not, see <http://www.gnu.org/licenses/>

from eidolon import ReprType, AxesType, ElemType, color

rootdir = scriptdir + '/MeshData'

m1 = mgr.cloneMaterial('Default')  # create a semitransparent material
m1.setAlpha(0.5)

m2 = mgr.cloneMaterial('Default')  # create a point material
m2.setPointSizeAbs(3.0)
m2.useLighting(False)
m2.useDepthCheck(False)
m2.setDiffuse(color(0.75, 0, 0))

obj = CHeart.loadSceneObject(rootdir + '/1d_FE.X', rootdir + '/1d_FE.T',
                             ElemType._Line2NL)  # load the vessels
df = obj.loadDataField(rootdir + '/1d_rad_avg_FE.D',
                       1)  # load per-node radius data

mgr.addSceneObject(obj)

# create a cylinder representation type, using 'df' as the radius field
rep = obj.createRepr(ReprType._cylinder, 30, radrefine=5, field=df)
mgr.addSceneObjectRepr(rep)
mgr.showBoundBox(rep)  # draw a bound box around the vessels
rep.applyMaterial(m1)

# create a representation type plotting the vessel lines, this will draw over the cylinders since m2 doesn't depth check