[Paraview] Write a reader plugin

Dr. X xunlei at renci.org
Fri Jan 21 17:07:18 EST 2011


Thanks, Utkarsh.
I can certainly adopt the interface vtkDataReader requires. However, 
vtkDataReader and its subclasses are VTK internal structures, i.e. they 
cannot be positioned as plugins, as I discovered. (what shall be the 
correct/formal wording on this phenomenon?). So I guess I have to use 
vtkXXXAlgorithm in order to produce a run-time plugin, right?

I was hoping to write the reader reading in both the header/metadata 
before I click apply and then the heavy data after I click apply. The 
hit apply, RequestInformation() is certainly called. And WHOLD_EXTENT() 
is populated within RequestInformation() and I verified WHOLE_EXTENT() 
right after RequestInformation() is called as well.

Any suggestions? Oh, I did put 0 to NumberOfInputPorts.
Best,
x

On 1/21/2011 3:32 PM, Utkarsh Ayachit wrote:
> vtkStructuredGridReader is a vtkDataReader subclass. So, unless you
> are writing a reader that reads a file similar to the legacy VTK
> files, I'd simply subclass vtkStructuredGridAlgorithm making sure that
> you set the NumberOfInputPorts to 0 in the constructor of your
> subclass.
>
> The information widget will only show any fields after you've hit
> apply. Does it still now show anything? Is so, try putting a break
> point in your RequestData() function, is that being called? Are you
> producing valid data there? You might always want to verify that you
> are reporting correct WHOLE_EXTENT() etc. in the RequestInformation
> function.
>
> Utkarsh.
>
> On Sat, Jan 15, 2011 at 5:43 PM, Xunlei Wu<xunlei at renci.org>  wrote:
>> Hi David and all,
>> I am writing a reader plugin for ParaView. A test program without the VTK wrapping approves that I can get all the header (metadata) and grid data correctly. However, when I following the examples posted in
>> http://www.vtk.org/Wiki/ParaView/Examples/Plugins/Reader
>> http://www.kitware.com/products/html/WritingAParaViewReaderPlug-in.html
>> and vtkStructuredGridReader.h/.cxx
>>
>> I got confused. Shall I subclass vtkStructuredGridAlgorithm or vtkStructuredGridReader? What are the differences? With minor differences in the code, i.e. defining char* FileName, I have both scenarios built fine.
>>
>> Let's say, we are subclassing vtkStructuredGridAlgorithm for now on. After I populate values as the following
>>
>> int vtkGRIB2Reader::RequestInformation(vtkInformation* vtkNotUsed(request),                                                             vtkInformationVector** vtkNotUsed(inputVector),                                                 vtkInformationVector *outputVector)
>> {
>>         ...
>>         vtkInformation* outInfo = outputVector->GetInformationObject(0);
>>
>>         outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),  ext, 6);
>>         outInfo->Set(vtkDataObject::SPACING(),  this->Spacing, 3);
>>         outInfo->Set(vtkDataObject::ORIGIN(),   this->Origin, 3);
>>
>>         return 1;
>> }
>>
>> In ParaView Object Inspector / Information widget, I did not see any update in all the fields except Statistics / Type: Structured (Curvilinear) Grid. Would you please help me? Did I populate outInof in the wrong place? Thanks a lot.
>>
>> Best,
>> xunlei
>>
>> _______________________________________________
>> 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>



More information about the ParaView mailing list