Skip to content
Snippets Groups Projects
Commit b0317e8d authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Simplified calculateSamplePoints interface, as it was far too

complicated. LineVector hardware draw implementation is now working.
parent 0b47f558
No related branches found
No related tags found
No related merge requests found
......@@ -174,29 +174,21 @@ def softwareDraw(self, zpos, xform=None):
def hardwareDraw(self, zpos, xform=None):
image = self.image
display = self.display
opts = self.displayOpts
v2dMat = self.display.getTransform('voxel', 'display')
upsample = display.transform == 'affine'
image = self.image
display = self.display
opts = self.displayOpts
v2dMat = self.display.getTransform('voxel', 'display')
resolution = np.array([display.resolution] * 3)
if display.transform == 'id':
pixdim = [1, 1, 1]
if display.transform == 'id':
resolution = resolution / min(image.pixdim[:3])
elif display.transform == 'pixdim': pixdim = image.pixdim[:3]
elif display.transform == 'affine': pixdim = [1, 1, 1]
vertices = globject.calculateSamplePoints(
image.shape,
pixdim,
resolution,
v2dMat,
self.xax,
self.yax,
upsample=upsample)[0]
self.yax)[0]
vertices[:, self.zax] = zpos
......
......@@ -184,12 +184,10 @@ class GLLineVector(glvector.GLVector):
# in the display coordinate system
coords = globject.calculateSamplePoints(
image.shape[ :3],
image.pixdim[:3],
[display.resolution] * 3,
display.getTransform('voxel', 'display'),
xax,
yax,
upsample=True)[0]
yax)[0]
coords[:, zax] = zpos
......
......@@ -224,13 +224,7 @@ class GLImageObject(GLObject):
self.displayOpts = display.getDisplayOpts()
def calculateSamplePoints(shape,
dims,
resolution,
xform,
xax,
yax,
upsample=False):
def calculateSamplePoints(shape, resolution, xform, xax, yax):
"""Calculates a uniform grid of points, in the display coordinate system
(as specified by the given
:class:`~fsl.fslview.displaycontext.Display` object properties) along the
......@@ -252,8 +246,6 @@ def calculateSamplePoints(shape,
:arg shape: The shape of the data to be sampled.
:arg dims: The dimensions, in display space, of one data point.
:arg xform: A transformation matrix which converts from data
coordinates to the display coordinate system.
......@@ -264,21 +256,10 @@ def calculateSamplePoints(shape,
2).
:arg yax: The vertical display coordinate system axis (0, 1, or 2).
:arg upsample: If ``True``, the same data point may be sampled more than
once.
"""
# Calculate the resolution along each display space axis
if not upsample:
xres = np.round(resolution[xax] / dims[xax])
yres = np.round(resolution[yax] / dims[yax])
if xres < 1: xres = 1
if yres < 1: yres = 1
else:
xres = resolution[xax]
yres = resolution[yax]
xres = resolution[xax]
yres = resolution[yax]
# These values give the min/max x/y
# values of a bounding box which
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment