Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in branchclipper #229

Closed
rlizzo opened this issue Feb 7, 2018 · 2 comments
Closed

Error in branchclipper #229

rlizzo opened this issue Feb 7, 2018 · 2 comments

Comments

@rlizzo
Copy link
Member

rlizzo commented Feb 7, 2018

Placeholder to remind me to fix this.

_____________________ test_clip_groupids_with_insideout_surface_returns_as_expected[groupids0-0] _____________________

aorta_centerline_branches = (vtkCommonDataModelPython.vtkPolyData)0x11cae9ca8
aorta_surface = (vtkCommonDataModelPython.vtkPolyData)0x11cae9e88, groupids = [0], paramid = '0'
compare_surfaces = <function compare_surfaces.<locals>.make_compare_surface at 0x11cad3950>
write_surface = <function write_surface.<locals>.make_write_surface at 0x11caee950>

    @pytest.mark.parametrize("groupids,paramid", [
        ([0], '0'),
        ([2], '2'),
        ([3], '3'),
        ([0, 2], '02'),
        ([2, 3], '23'),
    ])
    def test_clip_groupids_with_insideout_surface_returns_as_expected(aorta_centerline_branches, aorta_surface,
                                                                     groupids, paramid, compare_surfaces, write_surface):
        name = __name__ + '_test_clip_groupids_' + paramid + '_with_insideout_surface_returns_as_expected.vtp'
        clipper = branchclipper.vmtkBranchClipper()
        clipper.Centerlines = aorta_centerline_branches
        clipper.Surface = aorta_surface
        clipper.RadiusArrayName = 'MaximumInscribedSphereRadius'
        clipper.BlankingArrayName = 'Blanking'
        clipper.GroupIdsArrayName = 'GroupIds'
        clipper.GroupIds = groupids
        clipper.InsideOut = 1
>       clipper.Execute()

test_vmtkScripts/test_vmtkbranchclipper.py:78:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <vmtk.vmtkbranchclipper.vmtkBranchClipper object at 0x11cb0d7f0>

    def Execute(self):

        if not self.Surface:
            self.PrintError('Error: No input surface.')

        if not self.Centerlines:
            self.PrintError('Error: No input centerlines.')

        if self.Interactive and not self.vmtkRenderer:
            self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
            self.vmtkRenderer.Initialize()
            self.OwnRenderer = 1

        if self.Interactive:

            self.vmtkRenderer.RegisterScript(self)

            viewer = vmtkcenterlineviewer.vmtkCenterlineViewer()
            viewer.Centerlines = self.Centerlines
            viewer.CellDataArrayName = self.GroupIdsArrayName
            viewer.vmtkRenderer = self.vmtkRenderer
            viewer.InputText = self.InputText
            viewer.OutputText = self.OutputText
            viewer.PrintError = self.PrintError
            viewer.PringLog = self.PrintLog
            viewer.Display = 0
            viewer.Execute()

            groupIdsString = self.InputText("Please input groupIds to clip:\n",self.GroupIdsValidator)
            self.GroupIds = [int(groupId) for groupId in groupIdsString.split()]

        clipper = vtkvmtk.vtkvmtkPolyDataCenterlineGroupsClipper()
        clipper.SetInputData(self.Surface)
        clipper.SetCenterlines(self.Centerlines)
        clipper.SetCenterlineGroupIdsArrayName(self.GroupIdsArrayName)
        clipper.SetGroupIdsArrayName(self.GroupIdsArrayName)
        clipper.SetCenterlineRadiusArrayName(self.RadiusArrayName)
        clipper.SetBlankingArrayName(self.BlankingArrayName)
        clipper.SetCutoffRadiusFactor(self.CutoffRadiusFactor)
        clipper.SetClipValue(self.ClipValue)
        clipper.SetUseRadiusInformation(self.UseRadiusInformation)
        if self.GroupIds:
            groupIds = vtk.vtkIdList()
            for groupId in self.GroupIds:
                groupIds.InsertNextId(groupId)
            clipper.SetCenterlineGroupIds(groupIds)
            clipper.ClipAllCenterlineGroupIdsOff()
        else:
            clipper.ClipAllCenterlineGroupIdsOn()
        if not self.InsideOut:
            clipper.GenerateClippedOutputOff()
        else:
            clipper.GenerateClippedOutputOn()
        clipper.Update()

        if not self.InsideOut:
            self.Surface = clipper.GetOutput()
        else:
>           self.Surface = clipper.GetClippedOutputData()
E           AttributeError: 'vtkCommonCorePython.vtkvmtkPolyDataCenterlineGroup' object has no attribute 'GetClippedOutputData'
@rlizzo
Copy link
Member Author

rlizzo commented Feb 13, 2018

fixed.

@rlizzo rlizzo closed this as completed Feb 13, 2018
@myousefi2016
Copy link
Contributor

myousefi2016 commented Jul 26, 2019

Not really fixed... Of course it would clip insideout correctly but the problem is if -insideout flag is on, the associated data arrays will not be passed to the final clipped output. Any idea to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants