Commit 49ec5b18018f576f9437ffe5f98aa40e91bae63d
1 parent
09915b7f
Exists in
vtk6
generating surface with vtk6
Showing
2 changed files
with
62 additions
and
60 deletions
Show diff stats
invesalius/data/surface.py
@@ -42,6 +42,8 @@ try: | @@ -42,6 +42,8 @@ try: | ||
42 | except ImportError: | 42 | except ImportError: |
43 | import data.ca_smoothing as ca_smoothing | 43 | import data.ca_smoothing as ca_smoothing |
44 | 44 | ||
45 | +# TODO: Verificar ReleaseDataFlagOn and SetSource | ||
46 | + | ||
45 | class Surface(): | 47 | class Surface(): |
46 | """ | 48 | """ |
47 | Represent both vtkPolyData and associated properties. | 49 | Represent both vtkPolyData and associated properties. |
@@ -240,12 +242,12 @@ class SurfaceManager(): | @@ -240,12 +242,12 @@ class SurfaceManager(): | ||
240 | name=None, colour=None, | 242 | name=None, colour=None, |
241 | transparency=None, volume=None): | 243 | transparency=None, volume=None): |
242 | normals = vtk.vtkPolyDataNormals() | 244 | normals = vtk.vtkPolyDataNormals() |
243 | - normals.SetInput(polydata) | 245 | + normals.SetInputData(polydata) |
244 | normals.SetFeatureAngle(80) | 246 | normals.SetFeatureAngle(80) |
245 | normals.AutoOrientNormalsOn() | 247 | normals.AutoOrientNormalsOn() |
246 | 248 | ||
247 | mapper = vtk.vtkPolyDataMapper() | 249 | mapper = vtk.vtkPolyDataMapper() |
248 | - mapper.SetInput(normals.GetOutput()) | 250 | + mapper.SetInputData(normals.GetOutput()) |
249 | mapper.ScalarVisibilityOff() | 251 | mapper.ScalarVisibilityOff() |
250 | mapper.ImmediateModeRenderingOn() # improve performance | 252 | mapper.ImmediateModeRenderingOn() # improve performance |
251 | 253 | ||
@@ -289,11 +291,11 @@ class SurfaceManager(): | @@ -289,11 +291,11 @@ class SurfaceManager(): | ||
289 | # The following lines have to be here, otherwise all volumes disappear | 291 | # The following lines have to be here, otherwise all volumes disappear |
290 | if not volume: | 292 | if not volume: |
291 | triangle_filter = vtk.vtkTriangleFilter() | 293 | triangle_filter = vtk.vtkTriangleFilter() |
292 | - triangle_filter.SetInput(polydata) | 294 | + triangle_filter.SetInputData(polydata) |
293 | triangle_filter.Update() | 295 | triangle_filter.Update() |
294 | 296 | ||
295 | measured_polydata = vtk.vtkMassProperties() | 297 | measured_polydata = vtk.vtkMassProperties() |
296 | - measured_polydata.SetInput(triangle_filter.GetOutput()) | 298 | + measured_polydata.SetInputData(triangle_filter.GetOutput()) |
297 | volume = measured_polydata.GetVolume() | 299 | volume = measured_polydata.GetVolume() |
298 | surface.volume = volume | 300 | surface.volume = volume |
299 | print ">>>>", surface.volume | 301 | print ">>>>", surface.volume |
@@ -338,19 +340,19 @@ class SurfaceManager(): | @@ -338,19 +340,19 @@ class SurfaceManager(): | ||
338 | surface = surface_dict[key] | 340 | surface = surface_dict[key] |
339 | # Map polygonal data (vtkPolyData) to graphics primitives. | 341 | # Map polygonal data (vtkPolyData) to graphics primitives. |
340 | normals = vtk.vtkPolyDataNormals() | 342 | normals = vtk.vtkPolyDataNormals() |
341 | - normals.SetInput(surface.polydata) | 343 | + normals.SetInputData(surface.polydata) |
342 | normals.SetFeatureAngle(80) | 344 | normals.SetFeatureAngle(80) |
343 | normals.AutoOrientNormalsOn() | 345 | normals.AutoOrientNormalsOn() |
344 | - normals.GetOutput().ReleaseDataFlagOn() | 346 | + # normals.GetOutput().ReleaseDataFlagOn() |
345 | 347 | ||
346 | # Improve performance | 348 | # Improve performance |
347 | stripper = vtk.vtkStripper() | 349 | stripper = vtk.vtkStripper() |
348 | - stripper.SetInput(normals.GetOutput()) | 350 | + stripper.SetInputData(normals.GetOutput()) |
349 | stripper.PassThroughCellIdsOn() | 351 | stripper.PassThroughCellIdsOn() |
350 | stripper.PassThroughPointIdsOn() | 352 | stripper.PassThroughPointIdsOn() |
351 | 353 | ||
352 | mapper = vtk.vtkPolyDataMapper() | 354 | mapper = vtk.vtkPolyDataMapper() |
353 | - mapper.SetInput(stripper.GetOutput()) | 355 | + mapper.SetInputData(stripper.GetOutput()) |
354 | mapper.ScalarVisibilityOff() | 356 | mapper.ScalarVisibilityOff() |
355 | mapper.ImmediateModeRenderingOn() # improve performance | 357 | mapper.ImmediateModeRenderingOn() # improve performance |
356 | 358 | ||
@@ -490,30 +492,30 @@ class SurfaceManager(): | @@ -490,30 +492,30 @@ class SurfaceManager(): | ||
490 | break | 492 | break |
491 | 493 | ||
492 | polydata_append = vtk.vtkAppendPolyData() | 494 | polydata_append = vtk.vtkAppendPolyData() |
493 | - polydata_append.ReleaseDataFlagOn() | 495 | + # polydata_append.ReleaseDataFlagOn() |
494 | t = n_pieces | 496 | t = n_pieces |
495 | while t: | 497 | while t: |
496 | filename_polydata = q_out.get() | 498 | filename_polydata = q_out.get() |
497 | 499 | ||
498 | reader = vtk.vtkXMLPolyDataReader() | 500 | reader = vtk.vtkXMLPolyDataReader() |
499 | reader.SetFileName(filename_polydata) | 501 | reader.SetFileName(filename_polydata) |
500 | - reader.ReleaseDataFlagOn() | 502 | + # reader.ReleaseDataFlagOn() |
501 | reader.Update() | 503 | reader.Update() |
502 | - reader.GetOutput().ReleaseDataFlagOn() | 504 | + # reader.GetOutput().ReleaseDataFlagOn() |
503 | 505 | ||
504 | polydata = reader.GetOutput() | 506 | polydata = reader.GetOutput() |
505 | - polydata.SetSource(None) | 507 | + # polydata.SetSource(None) |
506 | 508 | ||
507 | - polydata_append.AddInput(polydata) | 509 | + polydata_append.AddInputData(polydata) |
508 | del reader | 510 | del reader |
509 | del polydata | 511 | del polydata |
510 | t -= 1 | 512 | t -= 1 |
511 | 513 | ||
512 | polydata_append.Update() | 514 | polydata_append.Update() |
513 | - polydata_append.GetOutput().ReleaseDataFlagOn() | 515 | + # polydata_append.GetOutput().ReleaseDataFlagOn() |
514 | polydata = polydata_append.GetOutput() | 516 | polydata = polydata_append.GetOutput() |
515 | #polydata.Register(None) | 517 | #polydata.Register(None) |
516 | - polydata.SetSource(None) | 518 | + # polydata.SetSource(None) |
517 | del polydata_append | 519 | del polydata_append |
518 | 520 | ||
519 | if algorithm == 'ca_smoothing': | 521 | if algorithm == 'ca_smoothing': |
@@ -521,31 +523,31 @@ class SurfaceManager(): | @@ -521,31 +523,31 @@ class SurfaceManager(): | ||
521 | normals_ref = weakref.ref(normals) | 523 | normals_ref = weakref.ref(normals) |
522 | normals_ref().AddObserver("ProgressEvent", lambda obj,evt: | 524 | normals_ref().AddObserver("ProgressEvent", lambda obj,evt: |
523 | UpdateProgress(normals_ref(), _("Creating 3D surface..."))) | 525 | UpdateProgress(normals_ref(), _("Creating 3D surface..."))) |
524 | - normals.SetInput(polydata) | ||
525 | - normals.ReleaseDataFlagOn() | 526 | + normals.SetInputData(polydata) |
527 | + # normals.ReleaseDataFlagOn() | ||
526 | #normals.SetFeatureAngle(80) | 528 | #normals.SetFeatureAngle(80) |
527 | #normals.AutoOrientNormalsOn() | 529 | #normals.AutoOrientNormalsOn() |
528 | normals.ComputeCellNormalsOn() | 530 | normals.ComputeCellNormalsOn() |
529 | - normals.GetOutput().ReleaseDataFlagOn() | 531 | + # normals.GetOutput().ReleaseDataFlagOn() |
530 | normals.Update() | 532 | normals.Update() |
531 | del polydata | 533 | del polydata |
532 | polydata = normals.GetOutput() | 534 | polydata = normals.GetOutput() |
533 | - polydata.SetSource(None) | 535 | + # polydata.SetSource(None) |
534 | del normals | 536 | del normals |
535 | 537 | ||
536 | clean = vtk.vtkCleanPolyData() | 538 | clean = vtk.vtkCleanPolyData() |
537 | - clean.ReleaseDataFlagOn() | ||
538 | - clean.GetOutput().ReleaseDataFlagOn() | 539 | + # clean.ReleaseDataFlagOn() |
540 | + # clean.GetOutput().ReleaseDataFlagOn() | ||
539 | clean_ref = weakref.ref(clean) | 541 | clean_ref = weakref.ref(clean) |
540 | clean_ref().AddObserver("ProgressEvent", lambda obj,evt: | 542 | clean_ref().AddObserver("ProgressEvent", lambda obj,evt: |
541 | UpdateProgress(clean_ref(), _("Creating 3D surface..."))) | 543 | UpdateProgress(clean_ref(), _("Creating 3D surface..."))) |
542 | - clean.SetInput(polydata) | 544 | + clean.SetInputData(polydata) |
543 | clean.PointMergingOn() | 545 | clean.PointMergingOn() |
544 | clean.Update() | 546 | clean.Update() |
545 | 547 | ||
546 | del polydata | 548 | del polydata |
547 | polydata = clean.GetOutput() | 549 | polydata = clean.GetOutput() |
548 | - polydata.SetSource(None) | 550 | + # polydata.SetSource(None) |
549 | del clean | 551 | del clean |
550 | 552 | ||
551 | try: | 553 | try: |
@@ -556,7 +558,7 @@ class SurfaceManager(): | @@ -556,7 +558,7 @@ class SurfaceManager(): | ||
556 | options['max distance'], | 558 | options['max distance'], |
557 | options['min weight'], | 559 | options['min weight'], |
558 | options['steps']) | 560 | options['steps']) |
559 | - polydata.SetSource(None) | 561 | + # polydata.SetSource(None) |
560 | polydata.DebugOn() | 562 | polydata.DebugOn() |
561 | 563 | ||
562 | else: | 564 | else: |
@@ -565,7 +567,7 @@ class SurfaceManager(): | @@ -565,7 +567,7 @@ class SurfaceManager(): | ||
565 | smoother_ref = weakref.ref(smoother) | 567 | smoother_ref = weakref.ref(smoother) |
566 | smoother_ref().AddObserver("ProgressEvent", lambda obj,evt: | 568 | smoother_ref().AddObserver("ProgressEvent", lambda obj,evt: |
567 | UpdateProgress(smoother_ref(), _("Creating 3D surface..."))) | 569 | UpdateProgress(smoother_ref(), _("Creating 3D surface..."))) |
568 | - smoother.SetInput(polydata) | 570 | + smoother.SetInputData(polydata) |
569 | smoother.SetNumberOfIterations(smooth_iterations) | 571 | smoother.SetNumberOfIterations(smooth_iterations) |
570 | smoother.SetRelaxationFactor(smooth_relaxation_factor) | 572 | smoother.SetRelaxationFactor(smooth_relaxation_factor) |
571 | smoother.SetFeatureAngle(80) | 573 | smoother.SetFeatureAngle(80) |
@@ -575,21 +577,21 @@ class SurfaceManager(): | @@ -575,21 +577,21 @@ class SurfaceManager(): | ||
575 | smoother.FeatureEdgeSmoothingOn() | 577 | smoother.FeatureEdgeSmoothingOn() |
576 | #smoother.NormalizeCoordinatesOn() | 578 | #smoother.NormalizeCoordinatesOn() |
577 | #smoother.NonManifoldSmoothingOn() | 579 | #smoother.NonManifoldSmoothingOn() |
578 | - smoother.ReleaseDataFlagOn() | ||
579 | - smoother.GetOutput().ReleaseDataFlagOn() | 580 | + # smoother.ReleaseDataFlagOn() |
581 | + # smoother.GetOutput().ReleaseDataFlagOn() | ||
580 | smoother.Update() | 582 | smoother.Update() |
581 | del polydata | 583 | del polydata |
582 | polydata = smoother.GetOutput() | 584 | polydata = smoother.GetOutput() |
583 | #polydata.Register(None) | 585 | #polydata.Register(None) |
584 | - polydata.SetSource(None) | 586 | + # polydata.SetSource(None) |
585 | del smoother | 587 | del smoother |
586 | 588 | ||
587 | 589 | ||
588 | if decimate_reduction: | 590 | if decimate_reduction: |
589 | print "Decimating", decimate_reduction | 591 | print "Decimating", decimate_reduction |
590 | decimation = vtk.vtkQuadricDecimation() | 592 | decimation = vtk.vtkQuadricDecimation() |
591 | - decimation.ReleaseDataFlagOn() | ||
592 | - decimation.SetInput(polydata) | 593 | + # decimation.ReleaseDataFlagOn() |
594 | + decimation.SetInputData(polydata) | ||
593 | decimation.SetTargetReduction(decimate_reduction) | 595 | decimation.SetTargetReduction(decimate_reduction) |
594 | decimation_ref = weakref.ref(decimation) | 596 | decimation_ref = weakref.ref(decimation) |
595 | decimation_ref().AddObserver("ProgressEvent", lambda obj,evt: | 597 | decimation_ref().AddObserver("ProgressEvent", lambda obj,evt: |
@@ -597,31 +599,31 @@ class SurfaceManager(): | @@ -597,31 +599,31 @@ class SurfaceManager(): | ||
597 | #decimation.PreserveTopologyOn() | 599 | #decimation.PreserveTopologyOn() |
598 | #decimation.SplittingOff() | 600 | #decimation.SplittingOff() |
599 | #decimation.BoundaryVertexDeletionOff() | 601 | #decimation.BoundaryVertexDeletionOff() |
600 | - decimation.GetOutput().ReleaseDataFlagOn() | 602 | + # decimation.GetOutput().ReleaseDataFlagOn() |
601 | decimation.Update() | 603 | decimation.Update() |
602 | del polydata | 604 | del polydata |
603 | polydata = decimation.GetOutput() | 605 | polydata = decimation.GetOutput() |
604 | #polydata.Register(None) | 606 | #polydata.Register(None) |
605 | - polydata.SetSource(None) | 607 | + # polydata.SetSource(None) |
606 | del decimation | 608 | del decimation |
607 | 609 | ||
608 | to_measure = polydata | 610 | to_measure = polydata |
609 | #to_measure.Register(None) | 611 | #to_measure.Register(None) |
610 | - to_measure.SetSource(None) | 612 | + # to_measure.SetSource(None) |
611 | 613 | ||
612 | if keep_largest: | 614 | if keep_largest: |
613 | conn = vtk.vtkPolyDataConnectivityFilter() | 615 | conn = vtk.vtkPolyDataConnectivityFilter() |
614 | - conn.SetInput(polydata) | 616 | + conn.SetInputData(polydata) |
615 | conn.SetExtractionModeToLargestRegion() | 617 | conn.SetExtractionModeToLargestRegion() |
616 | conn_ref = weakref.ref(conn) | 618 | conn_ref = weakref.ref(conn) |
617 | conn_ref().AddObserver("ProgressEvent", lambda obj,evt: | 619 | conn_ref().AddObserver("ProgressEvent", lambda obj,evt: |
618 | UpdateProgress(conn_ref(), _("Creating 3D surface..."))) | 620 | UpdateProgress(conn_ref(), _("Creating 3D surface..."))) |
619 | conn.Update() | 621 | conn.Update() |
620 | - conn.GetOutput().ReleaseDataFlagOn() | 622 | + # conn.GetOutput().ReleaseDataFlagOn() |
621 | del polydata | 623 | del polydata |
622 | polydata = conn.GetOutput() | 624 | polydata = conn.GetOutput() |
623 | #polydata.Register(None) | 625 | #polydata.Register(None) |
624 | - polydata.SetSource(None) | 626 | + # polydata.SetSource(None) |
625 | del conn | 627 | del conn |
626 | 628 | ||
627 | #Filter used to detect and fill holes. Only fill boundary edges holes. | 629 | #Filter used to detect and fill holes. Only fill boundary edges holes. |
@@ -629,59 +631,59 @@ class SurfaceManager(): | @@ -629,59 +631,59 @@ class SurfaceManager(): | ||
629 | #polydata_utils.FillSurfaceHole, we need to review this. | 631 | #polydata_utils.FillSurfaceHole, we need to review this. |
630 | if fill_holes: | 632 | if fill_holes: |
631 | filled_polydata = vtk.vtkFillHolesFilter() | 633 | filled_polydata = vtk.vtkFillHolesFilter() |
632 | - filled_polydata.ReleaseDataFlagOn() | ||
633 | - filled_polydata.SetInput(polydata) | 634 | + # filled_polydata.ReleaseDataFlagOn() |
635 | + filled_polydata.SetInputData(polydata) | ||
634 | filled_polydata.SetHoleSize(300) | 636 | filled_polydata.SetHoleSize(300) |
635 | filled_polydata_ref = weakref.ref(filled_polydata) | 637 | filled_polydata_ref = weakref.ref(filled_polydata) |
636 | filled_polydata_ref().AddObserver("ProgressEvent", lambda obj,evt: | 638 | filled_polydata_ref().AddObserver("ProgressEvent", lambda obj,evt: |
637 | UpdateProgress(filled_polydata_ref(), _("Creating 3D surface..."))) | 639 | UpdateProgress(filled_polydata_ref(), _("Creating 3D surface..."))) |
638 | filled_polydata.Update() | 640 | filled_polydata.Update() |
639 | - filled_polydata.GetOutput().ReleaseDataFlagOn() | 641 | + # filled_polydata.GetOutput().ReleaseDataFlagOn() |
640 | del polydata | 642 | del polydata |
641 | polydata = filled_polydata.GetOutput() | 643 | polydata = filled_polydata.GetOutput() |
642 | #polydata.Register(None) | 644 | #polydata.Register(None) |
643 | - polydata.SetSource(None) | 645 | + # polydata.SetSource(None) |
644 | polydata.DebugOn() | 646 | polydata.DebugOn() |
645 | del filled_polydata | 647 | del filled_polydata |
646 | 648 | ||
647 | normals = vtk.vtkPolyDataNormals() | 649 | normals = vtk.vtkPolyDataNormals() |
648 | - normals.ReleaseDataFlagOn() | 650 | + # normals.ReleaseDataFlagOn() |
649 | normals_ref = weakref.ref(normals) | 651 | normals_ref = weakref.ref(normals) |
650 | normals_ref().AddObserver("ProgressEvent", lambda obj,evt: | 652 | normals_ref().AddObserver("ProgressEvent", lambda obj,evt: |
651 | UpdateProgress(normals_ref(), _("Creating 3D surface..."))) | 653 | UpdateProgress(normals_ref(), _("Creating 3D surface..."))) |
652 | - normals.SetInput(polydata) | 654 | + normals.SetInputData(polydata) |
653 | normals.SetFeatureAngle(80) | 655 | normals.SetFeatureAngle(80) |
654 | normals.AutoOrientNormalsOn() | 656 | normals.AutoOrientNormalsOn() |
655 | - normals.GetOutput().ReleaseDataFlagOn() | 657 | + # normals.GetOutput().ReleaseDataFlagOn() |
656 | normals.Update() | 658 | normals.Update() |
657 | del polydata | 659 | del polydata |
658 | polydata = normals.GetOutput() | 660 | polydata = normals.GetOutput() |
659 | #polydata.Register(None) | 661 | #polydata.Register(None) |
660 | - polydata.SetSource(None) | 662 | + # polydata.SetSource(None) |
661 | del normals | 663 | del normals |
662 | 664 | ||
663 | # Improve performance | 665 | # Improve performance |
664 | stripper = vtk.vtkStripper() | 666 | stripper = vtk.vtkStripper() |
665 | - stripper.ReleaseDataFlagOn() | 667 | + # stripper.ReleaseDataFlagOn() |
666 | stripper_ref = weakref.ref(stripper) | 668 | stripper_ref = weakref.ref(stripper) |
667 | stripper_ref().AddObserver("ProgressEvent", lambda obj,evt: | 669 | stripper_ref().AddObserver("ProgressEvent", lambda obj,evt: |
668 | UpdateProgress(stripper_ref(), _("Creating 3D surface..."))) | 670 | UpdateProgress(stripper_ref(), _("Creating 3D surface..."))) |
669 | - stripper.SetInput(polydata) | 671 | + stripper.SetInputData(polydata) |
670 | stripper.PassThroughCellIdsOn() | 672 | stripper.PassThroughCellIdsOn() |
671 | stripper.PassThroughPointIdsOn() | 673 | stripper.PassThroughPointIdsOn() |
672 | - stripper.GetOutput().ReleaseDataFlagOn() | 674 | + # stripper.GetOutput().ReleaseDataFlagOn() |
673 | stripper.Update() | 675 | stripper.Update() |
674 | del polydata | 676 | del polydata |
675 | polydata = stripper.GetOutput() | 677 | polydata = stripper.GetOutput() |
676 | #polydata.Register(None) | 678 | #polydata.Register(None) |
677 | - polydata.SetSource(None) | 679 | + # polydata.SetSource(None) |
678 | del stripper | 680 | del stripper |
679 | 681 | ||
680 | # Map polygonal data (vtkPolyData) to graphics primitives. | 682 | # Map polygonal data (vtkPolyData) to graphics primitives. |
681 | mapper = vtk.vtkPolyDataMapper() | 683 | mapper = vtk.vtkPolyDataMapper() |
682 | - mapper.SetInput(polydata) | 684 | + mapper.SetInputData(polydata) |
683 | mapper.ScalarVisibilityOff() | 685 | mapper.ScalarVisibilityOff() |
684 | - mapper.ReleaseDataFlagOn() | 686 | + # mapper.ReleaseDataFlagOn() |
685 | mapper.ImmediateModeRenderingOn() # improve performance | 687 | mapper.ImmediateModeRenderingOn() # improve performance |
686 | 688 | ||
687 | # Represent an object (geometry & properties) in the rendered scene | 689 | # Represent an object (geometry & properties) in the rendered scene |
@@ -720,8 +722,8 @@ class SurfaceManager(): | @@ -720,8 +722,8 @@ class SurfaceManager(): | ||
720 | 722 | ||
721 | # The following lines have to be here, otherwise all volumes disappear | 723 | # The following lines have to be here, otherwise all volumes disappear |
722 | measured_polydata = vtk.vtkMassProperties() | 724 | measured_polydata = vtk.vtkMassProperties() |
723 | - measured_polydata.ReleaseDataFlagOn() | ||
724 | - measured_polydata.SetInput(to_measure) | 725 | + # measured_polydata.ReleaseDataFlagOn() |
726 | + measured_polydata.SetInputData(to_measure) | ||
725 | volume = float(measured_polydata.GetVolume()) | 727 | volume = float(measured_polydata.GetVolume()) |
726 | surface.volume = volume | 728 | surface.volume = volume |
727 | self.last_surface_index = surface.index | 729 | self.last_surface_index = surface.index |
@@ -858,14 +860,14 @@ class SurfaceManager(): | @@ -858,14 +860,14 @@ class SurfaceManager(): | ||
858 | if filetype in (const.FILETYPE_STL, const.FILETYPE_PLY): | 860 | if filetype in (const.FILETYPE_STL, const.FILETYPE_PLY): |
859 | # Invert normals | 861 | # Invert normals |
860 | normals = vtk.vtkPolyDataNormals() | 862 | normals = vtk.vtkPolyDataNormals() |
861 | - normals.SetInput(polydata) | 863 | + normals.SetInputData(polydata) |
862 | normals.SetFeatureAngle(80) | 864 | normals.SetFeatureAngle(80) |
863 | normals.AutoOrientNormalsOn() | 865 | normals.AutoOrientNormalsOn() |
864 | - normals.GetOutput().ReleaseDataFlagOn() | 866 | + # normals.GetOutput().ReleaseDataFlagOn() |
865 | normals.UpdateInformation() | 867 | normals.UpdateInformation() |
866 | polydata = normals.GetOutput() | 868 | polydata = normals.GetOutput() |
867 | 869 | ||
868 | filename = filename.encode(wx.GetDefaultPyEncoding()) | 870 | filename = filename.encode(wx.GetDefaultPyEncoding()) |
869 | writer.SetFileName(filename) | 871 | writer.SetFileName(filename) |
870 | - writer.SetInput(polydata) | 872 | + writer.SetInputData(polydata) |
871 | writer.Write() | 873 | writer.Write() |
invesalius/data/surface_process.py
@@ -26,7 +26,7 @@ def ResampleImage3D(imagedata, value): | @@ -26,7 +26,7 @@ def ResampleImage3D(imagedata, value): | ||
26 | resolution = (height/(extent[1]-extent[0])+1)*spacing[1] | 26 | resolution = (height/(extent[1]-extent[0])+1)*spacing[1] |
27 | 27 | ||
28 | resample = vtk.vtkImageResample() | 28 | resample = vtk.vtkImageResample() |
29 | - resample.SetInput(imagedata) | 29 | + resample.SetInputData(imagedata) |
30 | resample.SetAxisMagnificationFactor(0, resolution) | 30 | resample.SetAxisMagnificationFactor(0, resolution) |
31 | resample.SetAxisMagnificationFactor(1, resolution) | 31 | resample.SetAxisMagnificationFactor(1, resolution) |
32 | 32 | ||
@@ -106,7 +106,7 @@ class SurfaceProcess(multiprocessing.Process): | @@ -106,7 +106,7 @@ class SurfaceProcess(multiprocessing.Process): | ||
106 | "AXIAL") | 106 | "AXIAL") |
107 | 107 | ||
108 | gauss = vtk.vtkImageGaussianSmooth() | 108 | gauss = vtk.vtkImageGaussianSmooth() |
109 | - gauss.SetInput(image) | 109 | + gauss.SetInputData(image) |
110 | gauss.SetRadiusFactor(0.3) | 110 | gauss.SetRadiusFactor(0.3) |
111 | gauss.ReleaseDataFlagOn() | 111 | gauss.ReleaseDataFlagOn() |
112 | gauss.Update() | 112 | gauss.Update() |
@@ -125,7 +125,7 @@ class SurfaceProcess(multiprocessing.Process): | @@ -125,7 +125,7 @@ class SurfaceProcess(multiprocessing.Process): | ||
125 | image = ResampleImage3D(image, self.imagedata_resolution) | 125 | image = ResampleImage3D(image, self.imagedata_resolution) |
126 | 126 | ||
127 | flip = vtk.vtkImageFlip() | 127 | flip = vtk.vtkImageFlip() |
128 | - flip.SetInput(image) | 128 | + flip.SetInputData(image) |
129 | flip.SetFilteredAxis(1) | 129 | flip.SetFilteredAxis(1) |
130 | flip.FlipAboutOriginOn() | 130 | flip.FlipAboutOriginOn() |
131 | flip.ReleaseDataFlagOn() | 131 | flip.ReleaseDataFlagOn() |
@@ -148,7 +148,7 @@ class SurfaceProcess(multiprocessing.Process): | @@ -148,7 +148,7 @@ class SurfaceProcess(multiprocessing.Process): | ||
148 | #if self.mode == "CONTOUR": | 148 | #if self.mode == "CONTOUR": |
149 | #print "Contour" | 149 | #print "Contour" |
150 | contour = vtk.vtkContourFilter() | 150 | contour = vtk.vtkContourFilter() |
151 | - contour.SetInput(image) | 151 | + contour.SetInputData(image) |
152 | #contour.SetInput(flip.GetOutput()) | 152 | #contour.SetInput(flip.GetOutput()) |
153 | if self.from_binary: | 153 | if self.from_binary: |
154 | contour.SetValue(0, 127) # initial threshold | 154 | contour.SetValue(0, 127) # initial threshold |
@@ -202,7 +202,7 @@ class SurfaceProcess(multiprocessing.Process): | @@ -202,7 +202,7 @@ class SurfaceProcess(multiprocessing.Process): | ||
202 | 202 | ||
203 | filename = tempfile.mktemp(suffix='_%s.vtp' % (self.pid)) | 203 | filename = tempfile.mktemp(suffix='_%s.vtp' % (self.pid)) |
204 | writer = vtk.vtkXMLPolyDataWriter() | 204 | writer = vtk.vtkXMLPolyDataWriter() |
205 | - writer.SetInput(polydata) | 205 | + writer.SetInputData(polydata) |
206 | writer.SetFileName(filename) | 206 | writer.SetFileName(filename) |
207 | writer.Write() | 207 | writer.Write() |
208 | 208 |