[vtkusers] Active Scalars

tom fogal tfogal at apollo.sr.unh.edu
Tue Jul 27 11:01:20 EDT 2004


Well, I've now found out that the two sets of scalars should be very
similar, so a picture that looked the same would probably actually be
right.
I'd still like to know if I'm doing things 'correctly' though, or it
just appears to be working because I got lucky...

I set scalar data with the following code:

      attr->SetName("RR");
      output->GetPointData()->AddArray(attr);
      if(!output->GetPointData()->GetScalars())
         output->GetPointData()->SetScalars(attr);
      output->GetPointData()->SetActiveScalars("RR");
      attr->Delete();

'output' is the same pointer as object->GetOutput(), a
vtkRectilinearGrid. 'attr' is a 1-component vtkFloatArray.

In the code which uses the object, I use 'GenerateValues' to create
contours. I do it with the following code:

cut->GenerateValues(4,GGCM[0]->GetOutput()->GetPointData()->GetScalars()->GetRange());

where 'GGCM[0]' is an instance of my object. This isn't exactly
correct, because the input to my cutter is the rectilinear grid output
of a vtkInterpolateDataSetAttributes object, but I found that when I
tried to GetPointData()->GetScalars() on the Interpolated dataset, it
would give me a NULL pointer and would then crash when trying to
dereference it to get the range. In any case, its "mostly" correct =),
since the interpolated dataset comes out almost equivalent to the
initial seed... at least with the current data i'm feeding it.

I had guessed 'GenerateValues' was a good replacement for
'SetScalarRange', which is what the VTK User's Guide uses on page 83. I
found that this function did not exist in a vtkCutter, at least with my
version of VTK (stable, 4.2).

To answer your last question, I never SetGenerateCutScalars either way,
so it takes whatever the default is. My guess is that means it is
interpolating from the scalar input data.

Thanks!

-tom

 <BAY1-DAV17O6WcISKEH00001306 at hotmail.com>"Huiqun Zhou" writes:
>You'd better give more detail of your code. At least. on the surface your
>understanding is not
>wrong. How did you set the SetGenerateCutScalars, on or off?
>
>Huiqun Zhou
>
>
>----- Original Message ----- 
>From: "tom fogal" <tfogal at apollo.sr.unh.edu>
>To: <vtkusers at vtk.org>
>Sent: Tuesday, July 27, 2004 7:08 AM
>Subject: [vtkusers] Active Scalars
>
>
>> I'm curious about what exactly VTK does with the 'Active' scalar values
>> in a RectilinearGrid (or maybe it does the same for
>> Unstructured-/Structured- Grids, etc). I've been creating 2d cuts of a
>> dataset with one set of 'active' scalar values, creating images of
>> them, and today I've started using a whole new set but I'm still seeing
>> the same resulting images!
>>
>> I assumed that a 2d cut of a RectilinearGrid would give me a rectangle
>> with the color at each location indication the value at that location,
>> where higher values are given a color closer to red, lower values
>> closer to blue. Perhaps this is not how vtkCutter works when given a
>> vtkPlane? Maybe it is using my active vector values... ?
>>
>> Can anybody clarify how this works?
>>
>> -tom
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>



More information about the vtkusers mailing list