# Paraview Sample Over Line

**URL:** https://discourse.paraview.org/t/paraview-sample-over-line/16587
**Category:** ParaView Support
**Created:** [May 8, 2025, 1:14pm UTC](https://discourse.paraview.org/t/paraview-sample-over-line/16587 "2025-05-08T13:14:15Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Frankx9](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/f/3e96dc/32.png) [@Frankx9](https://discourse.paraview.org/u/Frankx9)
#### Post date: [May 8, 2025, 1:14pm UTC](https://discourse.paraview.org/t/paraview-sample-over-line/16587/1 "2025-05-08T13:14:16Z")

</div>

Hi,

what is the equivalent vtk class used in the Paraview sample over line GUI? I would like to replicate it in python with the vtk wrappers

Best

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [May 8, 2025, 1:30pm UTC](https://discourse.paraview.org/t/paraview-sample-over-line/16587/2 "2025-05-08T13:30:16Z")

</div>

Internally, ParaView is using the custom [`vtkPVProbeLineFilter`](https://gitlab.kitware.com/paraview/paraview/-/blob/master/VTKExtensions/FiltersParallelDIY2/vtkPVProbeLineFilter.h). I believe this is basically doing a [`vtkProbeFilter`](https://vtk.org/doc/nightly/html/classvtkProbeFilter.html) with a [`vtkLineSource`](https://vtk.org/doc/nightly/html/classvtkLineSource.html) but with _a lot_ of special sauce to make it work in parallel.

---

<div class="post-metadata">

### Author: ![Frankx9](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/f/3e96dc/32.png) [@Frankx9](https://discourse.paraview.org/u/Frankx9)
#### Post date: [May 8, 2025, 2:00pm UTC](https://discourse.paraview.org/t/paraview-sample-over-line/16587/3 "2025-05-08T14:00:02Z")

</div>

Thanks a lot!  
It seems that I was able to find it but I am unable to locate the equivalent of `Sampling Pattern` in the vtk python wrapper where only the following methods are exposed

```auto
    def CategoricalDataOff(self) -> None: ...
    def CategoricalDataOn(self) -> None: ...
    def ComputeToleranceOff(self) -> None: ...
    def ComputeToleranceOn(self) -> None: ...
    def GetCategoricalData(self) -> int: ...
    def GetCellLocatorPrototype(self) -> 'vtkAbstractCellLocator': ...
    def GetComputeTolerance(self) -> bool: ...
    def GetFindCellStrategy(self) -> 'vtkFindCellStrategy': ...
    def GetNumberOfGenerationsFromBase(self, type:str) -> int: ...
    @staticmethod
    def GetNumberOfGenerationsFromBaseType(type:str) -> int: ...
    def GetPassCellArrays(self) -> int: ...
    def GetPassFieldArrays(self) -> int: ...
    def GetPassPointArrays(self) -> int: ...
    def GetSnapToCellWithClosestPoint(self) -> bool: ...
    def GetSource(self) -> 'vtkDataObject': ...
    def GetSpatialMatch(self) -> int: ...
    def GetTolerance(self) -> float: ...
    def GetValidPointMaskArrayName(self) -> str: ...
    def GetValidPoints(self) -> 'vtkIdTypeArray': ...
    def IsA(self, type:str) -> int: ...
    @staticmethod
    def IsTypeOf(type:str) -> int: ...
    def NewInstance(self) -> 'vtkProbeFilter': ...
    def PassCellArraysOff(self) -> None: ...
    def PassCellArraysOn(self) -> None: ...
    def PassFieldArraysOff(self) -> None: ...
    def PassFieldArraysOn(self) -> None: ...
    def PassPointArraysOff(self) -> None: ...
    def PassPointArraysOn(self) -> None: ...
    @staticmethod
    def SafeDownCast(o:'vtkObjectBase') -> 'vtkProbeFilter': ...
    def SetCategoricalData(self, _arg:int) -> None: ...
    def SetCellLocatorPrototype(self, __a:'vtkAbstractCellLocator') -> None: ...
    def SetComputeTolerance(self, _arg:bool) -> None: ...
    def SetFindCellStrategy(self, __a:'vtkFindCellStrategy') -> None: ...
    def SetPassCellArrays(self, _arg:int) -> None: ...
    def SetPassFieldArrays(self, _arg:int) -> None: ...
    def SetPassPointArrays(self, _arg:int) -> None: ...
    def SetSnapToCellWithClosestPoint(self, _arg:bool) -> None: ...
    def SetSourceConnection(self, algOutput:'vtkAlgorithmOutput') -> None: ...
    def SetSourceData(self, source:'vtkDataObject') -> None: ...
    def SetSpatialMatch(self, _arg:int) -> None: ...
    def SetTolerance(self, _arg:float) -> None: ...
    def SetValidPointMaskArrayName(self, _arg:str) -> None: ...
    def SnapToCellWithClosestPointOff(self) -> None: ...
    def SnapToCellWithClosestPointOn(self) -> None: ...
    def SpatialMatchOff(self) -> None: ...
    def SpatialMatchOn(self) -> None: ...

```

Best

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [May 8, 2025, 2:35pm UTC](https://discourse.paraview.org/t/paraview-sample-over-line/16587/4 "2025-05-08T14:35:45Z")

</div>

Uh, weird. The class has `SetPoint1` and `SetPoint2` methods. I don’t know why those are not coming through in the python bindings. (They must work with the client/server bindings.)

Maybe someone who knows more about the wrapping could answer.

---

<div class="post-metadata">

### Author: ![Frankx9](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/f/3e96dc/32.png) [@Frankx9](https://discourse.paraview.org/u/Frankx9)
#### Post date: [May 9, 2025, 5:41am UTC](https://discourse.paraview.org/t/paraview-sample-over-line/16587/5 "2025-05-09T05:41:42Z")

</div>

> I believe this is basically doing a [`vtkProbeFilter`](https://vtk.org/doc/nightly/html/classvtkProbeFilter.html) with a [`vtkLineSource`](https://vtk.org/doc/nightly/html/classvtkLineSource.html) but with _a lot_ of special sauce to make it work in parallel.

After checking it is like that but I get different results when using the GUI in paraview and the vtk python bindings (Same starting and end point and same file)

GUI

 ![Screenshot 2025-05-09 at 07.40.19](https://discourse.paraview.org/uploads/default/original/3X/6/7/678ef2ee8e00b4e6f5d2403e61617f0389db6f9d.png)

python

 ![Screenshot 2025-05-09 at 07.39.32](https://discourse.paraview.org/uploads/default/original/3X/7/a/7a118fb86b1fd584d83e62e498c25043e2069312.jpeg)

Where the python bindings have been used as:

```auto
        line = LineSource(pointa, pointb, resolution).output
        alg = vtkProbeFilter() # Construct the ProbeFilter object
        alg.SetInputData(line) # Set the Input data (actually the source i.e. where to sample from)
        # Set the Source data (actually the target, i.e. where to sample to)
        alg.SetSourceData(wrap(self._obj))
        alg.SetPassCellArrays(True)
        alg.SetPassPointArrays(True)
        alg.SetPassFieldArrays(True)

        if locator:
            if isinstance(locator, str):
                locator_map = {
                    'cell': vtkCellLocator(),
                    'cell_tree': vtkCellTreeLocator(),
                    'obb_tree': vtkOBBTree(),
                    'static_cell': vtkStaticCellLocator(),
                }
                try:
                    locator = locator_map[locator]
                except KeyError as err:
                    msg = f'locator must be a string from {locator_map.keys()}, got {locator}'
                    raise ValueError(msg) from err
            alg.SetCellLocatorPrototype(locator)

        if tolerance is not None:
            alg.SetComputeTolerance(False)
            alg.SetTolerance(tolerance)

        _update_alg(alg, progress_bar, 'Resampling array Data from a Passed Mesh onto Mesh')
        return _get_output(alg), only_valid)

```

Vtk is installed as version

```auto
vtk 9.4.2

```

The issue appear to be very close to the wall region where the local resolution is higher.

Any idea?
