[vtkusers] how to attach multi-attributes to the same dataset?

David E DeMarle dave.demarle at kitware.com
Thu Jul 19 10:53:15 EDT 2012


I agree with Alex.

Some of the older filters, and in particular many of the imaging
filters, don't respect vtkAlgorithm::SetInputArrayToProcess and
instead always operate on the array marked as the ActiveScalars (or
ActiveVectors or what have you).

So insert a vtkAssignAttribute filter in your pipeline and use that to
specify which array is the active scalars just like Alex is doing
directly on the data object.


David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Mon, Jul 16, 2012 at 7:09 PM, Alex Malyushytskyy
<alexmalvtk at gmail.com> wrote:
> I have no experience with python,
> but normally y SetActiveScalars is a function you are looking for normally.
> and it should be called for dataset.
>
> For  regular dataset it would probably look like :
> sgrid.GetPointData().SetActiveScalars("ScalarNameYouWantToMakeActive")
>
> You will have to test it yourself with multiblock dataset yourself though
>
>
> Regards,
>       Alex
>
>
>
> On Mon, Jul 16, 2012 at 1:53 AM, April.Q <qinjiameilf at 163.com> wrote:
>> Thanks David E DeMarle, it works.
>> Now i get many StructuredGrids , all of them has two attributes scalar_1 and
>> scalar_2.
>> Then i use these StructuredGrids build a vtkMultiBlockDataset.
>> I want to render these vtkMultiBlockDataset and find one topic about it ,and
>> see your advice .
>> How to tell the filter to operate on a specific array(eg. only render a
>> slice of scalar_2)??Tell which filter ??
>>
>> I use python ,and i do like this:
>>
>>      pipeline = vtk.vtkCompositeDataPipeline()
>>      algorithm = vtk.vtkAlgorithm()
>>      algorithm.SetDefaultExecutivePrototype(pipeline)
>>
>>      compositeFilter = vtk.vtkCompositeDataGeometryFilter()
>>      compositeFilter.SetInput(MyMultiBlockDataset)
>>      compositeFilter.Update()
>>
>>      colors = vtk.vtkImageMapToColors()
>>      colors.SetInputConnection(compositeFilter.GetOutputPort())
>>      colors.SetLookupTable(MyLookupTable)
>>      colors.Update()
>>
>>      imageReslice = vtk.vtkImageReslice()
>>      imageReslice.SetInput(colors.GetOutput())
>>
>>      sliceMapper = vtk.vtkImageMapper()
>>      sliceMapper.SetInputConnection(imageReslice.GetOutputPort())
>>
>>      sliceActor = vtk.vtkActor()
>>      sliceActor.SetMapper(sliceMapper)
>> #ValueError: method requires a vtkMapper, a
>> #  vtkOpenGLImageMapper was provided.
>>
>>      renderer...
>>      renWin...
>>      iren...
>>       ... ...
>>
>> --
>> View this message in context: http://vtk.1045678.n5.nabble.com/how-to-attach-multi-attributes-to-the-same-dataset-tp5714692p5714714.html
>> Sent from the VTK - Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list