I'd like to create segmented seed regions for streamtracer

I’d like to trace out a 2D pattern in a 3D space to provide seed region for streamtracer. I don’t see any way to do that. All I see is the linear region. Is there some hidden method I could hack to do this?

The tutorial that covers this mentions a 3D structured grid. I don’t have one of these because I’m not coming from one of the approved simulation packages. Getting things into Paraview has always held me back from using it more. Is there some way to create hand-drawn surfaces or volumes? I can’t use the isosurface technique because my 3D data is normalized, and it’s 3D.

Any suggestions?

Perhaps I could ask a slightly different question.
How do I create or import surfaces into Paraview and place them relative to my vector field? Is there a special file format that Paraview understands that would permit a surface + 3D vector field to be imported?

The demos and instructions I have so far found for this task assume that I’ve used a simulation package, which is not the case. I’m generating the 3D vector field using a program we’ve written.

I’m not sure to follow what you are asking. You can use StreamTracerWithCustomSource to trace streamlines in a vector field from a specific set of seeds.

I can see the typical method using the streamtracer filter. This filter only allows a linear seed source. What I need to do is trace out on my 3D vector field an area or volume to serve as a seed source. I see examples of other people creating isosurfaces from scalar fields to use as seed regions. I don’t have one of these. This is obviously one way of doing things, but I would then need to concoct some scalar field that generates the desired result and combine it somehow with my 3D data. What I would prefer is some method where I can trace some surface in 3space and use that as a seed region.

Alternatively, I could introduce a plane that has scalar values and possibly create an isosurface from that. But the plane would need to be aligned to the vector dataset. And I can’t really see a way of doing this. if I introduce a scalar dataset, Paraview would treat it as a separate dataset. How will the streamtracer know to take a seed region from one dataset and trace lines on another dataset?

To me, it looks as is Paraview is compartmentalizing its data so that the filters can’t act across datasets.

Feel free to tell me how Paraview is supposed to work. I have not been able to get it to do anything more than elementary vector display.

You exactly need the StreamTracerWithCustomSource it allows you to use one dataset (a surface, a set of points…) as seed sources and trace streamlines with these seeds in another dataset (usally a vector field).

1 Like

Thanks mathieu, but that’s not really a solution to the problem. The problem is how to create the custom source. The examples that I have seen on this matter do not help.

I’m not sure what the problem is, can’t you use a Contour to create your iso surface ?

How do you countour a 3D vector field?

Here is a state file demonstrating how to contour a random vector field by its X component.
contour.pvsm (431.6 KB)

@Jim do you have a surface stored in a file? If so, assuming ParaView can load it, you can import that into ParaView and use it as the seed point source using the Stream Tracer With Custom Source as @mwestphal mentioned . Select your 3D vector field first, and add the Stream Tracer With Custom Source. A dialog box will appear. Leave the “Input” set to your 3D vector field. Now click on the “Seed Source” and selected your surface that is to act as the seed point source. Click OK and you should be in business.

@cory.quammen: I like this idea, but don’t know how. Let me explain our setup a bit. We start with a stack of images and assign a vector to each pixel on the image. We then assemble this into a stack of 3D vectors to make the vector field. We read it in as raw format.

What I would prefer is to go back to one of our image files, trace an outline on the image and save that into a format that would integrate with the 3D vector field and be at the correct z plane. And while I see a number of input file formats available, I could really use a target format that would allow this sort of thing. Reading in image files, I don’t think would allow me to create a seed surface in Paraview because I don’t see an editor to select regions on the image. So, I’m assuming it would need to be done outside Paraview. What would suggest to be the first step to accomplish that? I could also potentially bring in the whole image stack and possibly put an isosurface on it, but I wouldn’t have a lot of control over that because it would put surfaces everywhere, and I just want to probe a small area/volume.

How do you trace this outline, in mathematical terms ?

I see. You are right, there is no explicit tracing function in ParaView. A couple options come to mind:

  • There are point and cell selection tools you can activate by clicking the small icons just above the 3D render view. You probably would want to use the “Interactive Select Points On” to select points in the region you want. Then click the points you want to treat as stream tracers seeds and add an Extract Selection filter to pull these points into a separate data set that you can use as the “Seed Source” in the Stream Tracer With Custom Source filter.

  • Add a Poly Line Source and use it as the “Seed Source”. The Poly Line Source lets you draw a polygonal region, though the points are in 3D, so it’s a little less convenient than say drawing on a single 2D image. But you can interactively move the points in the source and these will be treated as seed points in the stream tracer.

I would probably read it into ImageJ, use a threshold, exclude anything which isn’t part of our target, then erode a few pixels. I can then generate either an polyline outline or a 2D monochrome bitmap.

@cory.quammen: I added a polyline source as a closed simple polygon, but it doesn’t work with the streamline with custom source. Is there a secret step to get this to work? I was thinking there should be a control to determine the seeding, number of points, etc. I don’t see one. The regular streamtraces works fine, just can’t be controlled the way I need it.

The points defining the polyline will serve as the seed points. Right, you want a sampling within that polygon. Alas, there is no such facility. Sorry for the confusion.

At the risk of sending you down a rabbit hole again, you could do the following.

  • Apply an Extract Subset filter to get the z slice of interest.
  • Apply a Threshold filter on the z slice.
  • Apply a Mask Points filter to the thresholded result.
  • Use the Mask Points filter as the “Seed Source” in the stream tracer.

Mask Points has options for randomly sampling points from the threshold result.

@cory.quammen: I just started adding points to the polyline to outline the region, and it looks OK. The next issue seems to be that the integration routine for streamtracer doesn’t do well when the z grid spacing is different from x&y. Is there a way to resample the 3D vector dataset to get isotropic spacing? I suspect it’s going to work much better on this data.
I have another way to do it, which I will test, but I would prefer to control this in Paraview if it’s available.

That’s a little surprising - maybe adjust the minimum step size?

You can resample data with the Resample To Image filter.