[Paraview] How to choose 2 input arrays

Rafael Küng rafi.kueng at gmx.ch
Wed Feb 16 10:10:26 EST 2011


Hi all

I would like to write a filter where i can select 2 arrays of the input 
polydata in the gui (for advanced filtering options, simply aplying the 
filter twice wouldn't help)

I did get the filter running with one selection ability like this:

vtkTrackFilter.cxx
----------
...
vtkTrackFilter2::vtkTrackFilter2()
{
	this->SetInputArrayToProcess(
		0,
		0,
		0,
		vtkDataObject::FIELD_ASSOCIATION_POINTS_THEN_CELLS,
		vtkDataSetAttributes::SCALARS);
}

...

int vtkTrackFilter2::RequestData(vtkInformation*,vtkInformationVector** 
inputVector,vtkInformationVector* outputVector)
{
	vtkInformation* outInfo = outputVector->GetInformationObject(0);
	vtkPolyData* output = vtkPolyData::GetData(outputVector);
	vtkPolyData* input = vtkPolyData::GetData(inputVector[0]);

	vtkSmartPointer<vtkCellArray> tracks = input->GetLines();
	vtkDataArray* filterArray = this->GetInputArrayToProcess(0, inputVector);

...
}
----------
and in the xml file: trackFilter.xml
----------
<ServerManagerConfiguration>
	<ProxyGroup name="filters">
		<SourceProxy name="TrackFilter" class="vtkTrackFilter" 
label="TrackFilter">
			<Documentation
				long_help="Selects specific tracks"
				short_help="Filter Track">
				doku text here
			</Documentation>
	
			<InputProperty
				name="Input"
				command="SetInputConnection">
				<ProxyGroupDomain name="groups">
					<Group name="sources"/>
					<Group name="filters"/>
				</ProxyGroupDomain>
				<DataTypeDomain name="input_type">
					<DataType value="vtkPolyData"/>
				</DataTypeDomain>
				<InputArrayDomain name="input_array">
					<RequiredProperties>
						<Property name="SelectInputArray"
							function="FieldDataSelection"/>
						</RequiredProperties>
				</InputArrayDomain>
			</InputProperty>
			
			<StringVectorProperty
				name="SelectInputArray"
				command="SetInputArrayToProcess"
				label="Select all Tracks, where"
				number_of_elements="5"
				element_types="0 0 0 0 2"
				animateable="0">
				<ArrayListDomain name="array_list"
					attribute_type="Scalars">
					<RequiredProperties>
						<Property name="Input" function="Input"/>
					</RequiredProperties>
				</ArrayListDomain>
				<FieldDataDomain name="field_list">
					<RequiredProperties>
						<Property name="Input" function="Input"/>
					</RequiredProperties>
				</FieldDataDomain>
				<Documentation>
				This property indicates which array to filter for.
				</Documentation>
			</StringVectorProperty>	

...

		</SourceProxy>
	</ProxyGroup>
</ServerManagerConfiguration>

----------

Any hint how to ajust my code so i get this? Sorry, it's quite hard for 
me to understand the input ports, connection, idx stuff.. i suppose 
something like this would be the solution? can anyone point me to an 
example or give advice?

Thank you very much
Rafael Kueng
Physics - University of Zurich


More information about the ParaView mailing list