[vtkusers] pieces streaming mechanism

David E DeMarle dave.demarle at kitware.com
Thu Jun 9 13:12:48 EDT 2011


Responses inline...

2011/6/9 Frédéric Speisser <frederic.speisser at grooviz.com>

>  Thank you David for your response.
> I had already took a look to TestPriorityStreaming in vtk and to Paraview
> StreamingView code but i can't get it work...
> Here is a sample code I use for test, am I doing something wrong ?
>
>
> // Dummy clipper only used to set bounding box of pieces to read
> // Only ProcessRequest method is redefined
>
> class VtkClipDataSetExtend : public vtkClipDataSet
> {
> public:
>     vtkTypeMacro(VtkClipDataSetExtend,vtkClipDataSet);
>
>     static VtkClipDataSetExtend *New();
>
>
> protected:
>     VtkClipDataSetExtend() {}
>     virtual ~VtkClipDataSetExtend() {}
>
>     int VtkClipDataSetExtend::ProcessRequest(vtkInformation* request,
>         vtkInformationVector** inputVector,
>         vtkInformationVector* outputVector)
>     {
>
>         vtkInformation *outInfo = outputVector->GetInformationObject(0);
>
>         vtkStreamingDemandDrivenPipeline *sdd =
>
> vtkStreamingDemandDrivenPipeline::SafeDownCast(this->GetExecutive());
>
>         if (sdd == NULL)
>         {
>             return -1;
>         }
>
>         // Bounds of pieces to read
>         int extent[6];
>
>
What are you trying to do with the following code? Update extents should be
negotiated between the source and sink of the pipeline. Structured readers
set the WHOLE_EXTENT in the RequestInformation pass to announce what they
can potentially produce. The downstream end then asks for a particular
subextent during the RequestUpdateExtent pass. During that negotiation,
vtkExtentTranslators are invoked by the pipeline to map from unstructured
extent requests to structured extents, if needed.

The code below appears to operate in all passes, not just
RequestUpdateExtent where extents are meant to be asked of the input, and
asks for a single voxel.


>          extent[0] = 0;
>         extent[1] = 1;
>         extent[2] = 0;
>         extent[3] = 1;
>         extent[4] = 0;
>         extent[5] = 1;
>
>         vtkDebugMacro(<<"SetUpdateExtent "
>             << extent[0] << "  " << extent[1] << "  "
>             << extent[2] << "  " << extent[3] << "  "
>             << extent[4] << "  " << extent[5] << "  ");
>
>         // Set these bounds in pipeline
>         sdd->SetUpdateExtent(outInfo, extent);
>
>
>
>         return 1;
>     }
>
> };
>
> vtkStandardNewMacro(VtkClipDataSetExtend);
>
> ..........
>
> {
> ..........
>
> //----------------------------------------------------------------------------------------------------//
>         // writer
>         // generate a pieces splitted image file
>         if(writeFile)
>         {
>             vtkImageGridSource* const source = vtkImageGridSource::New();
>             source->SetDataScalarTypeToShort();
>             source->SetFillValue((double)0xAAAA);
>             source->SetDataExtent(0, DATASOURCESIZE-1, 0, DATASOURCESIZE-1,
> 0, DATASOURCESIZE-1);
>
>             // parallel image writer
>             vtkSmartPointer<vtkXMLPImageDataWriter> writer =
> vtkSmartPointer<vtkXMLPImageDataWriter>::New();
>
>             // connect data source
>             writer->SetInputConnection(source->GetOutputPort());
>             source->Delete();
>
>             // settings
>             writer->SetFileName("PartShortVolume16.pvti");
>             writer->SetNumberOfPieces(NUMPIECES);
>
>             // range of pieces assigned to this writer
>             writer->SetStartPiece(0);
>             writer->SetEndPiece(NUMPIECES-1);
>
>             // split xml ref / data
>             writer->SetWriteSummaryFile(TRUE);
>
>             // write
>             writer->Update();
>             writer->Write();
>         }
>
>         // reader
>         vtkSmartPointer<vtkXMLPImageDataReader> reader =
> vtkSmartPointer<vtkXMLPImageDataReader>::New();
>         reader->SetFileName("PartShortVolume16.pvti");
>
>         reader->ReleaseDataFlagOn();
>
>         reader->DebugOn();
>
>         // clipping
>         vtkSmartPointer<VtkClipDataSetExtend> clipper =
> vtkSmartPointer<VtkClipDataSetExtend>::New();
>         vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();
>         plane ->SetNormal(1.0,0.0,0.0);
>         plane >SetOrigin(5.5,5.5,5.5);
>         clipper ->SetClipFunction(plane);
>
>         // pipeline connections
>         vtkSmartPointer<vtkDataSetMapper> mapper =
> vtkSmartPointer<vtkDataSetMapper>::New();
>         clipper ->SetInputConnection(reader->GetOutputPort());
>         mapper ->SetInputConnection(clipper ->GetOutputPort());
>
>         // Send the request of update to the reader
>         // The reader should only read pieces include in bounds defined by
> extent set in clipper
>         // But all pieces are loaded ... custom extent is not retrieved by
> reader ?
>         mapper->Update();
>

The mapper can ask for whatever extent it wants, and probably is asking for
the whole thing by default. See vtkPolyDataMapper::Set*Piece for an example
of how that can be changed.

}
>
> Is somewhere maybe a documentation explaining the mechanism of pieces
> streaming and how to use it ? ...
>
>
I'm not aware of anything definitive.

Do make sure that you understand pipeline passes, especially
REQUEST_UPDATE_EXTENT, where pieces are asked from upstream. The pipeline is
described in Chapter 15 of the VTK Users guide, 11'th edition and more
briefly in this kitware source issue:
  http://www.kitware.com/products/archive/kitware_quarterly0706.pdf

The way I've personally used streaming and why is described here:
  http://www.vtk.org/Wiki/StreamingParaView
and in this kitware source issue:
  http://www.kitware.com/products/archive/kitware_quarterly1010.pdf

Others on the list can chime in if they've used it in other ways, most
likely directly within VTK's imaging filters.


>  Thank you again !
>
> Le 08/06/2011 19:09, David E DeMarle a écrit :
>
> Look in the ParaView source code under the
> directory Plugins/StreamingView/VTK. That directory does not need ParaView,
> ie you can compile it against a standalone VTK build. The tests should be
> particularly helpful.
>
>  I have not tried vtkXMLPImageDataReader so it might take some work to use
> the files you have at hand. However, vtkXMLImageDataReader (note the lack of
> P) does work with streaming. Instead of separate files streaming takes
> advantage of the little exercised sub pieces within a single vti file
> feature to do what it needs to with this file format.
>
>  See VTK/Rendering/Testing/Cxx/TestPriorityStreaming for more information.
>
>  David E DeMarle
> Kitware, Inc..
> R&D Engineer
> 28 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-371-3971 x109
>
>
> 2011/6/8 Frédéric Speisser <frederic.speisser at grooviz.com>
>
>> All,
>>
>> I have a data object stored in pvti format (splitted in several pieces)
>> and I would like to be able to stream only pieces involved in rendering.
>> This should be possible in vtk, referring documentation.
>> I use vtkStreamindDemandDrivenPipeline and
>> vtkStreamindDemandDrivenPipeline::UPDATE_EXTENT, but despite the fact I set
>> bounds defining only a little part of my dataobject in update_extent key,
>> the reader(vtkXMLPImageDataReader) always loads all pieces...
>> I have made plenty of tests but I'm not able to make this mechanism
>> working.
>>
>> I need some help/hints !
>>
>> Thank you
>>
>> _______________________________________________
>> Powered by www.kitware..com <http://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
>>
>
>  ------------------------------
>
> Aucun virus trouvé dans ce message.
> Analyse effectuée par AVG - www.avg.fr
> Version: 10.0.1382 / Base de données virale: 1511/3688 - Date: 08/06/2011
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110609/98f41c80/attachment.htm>


More information about the vtkusers mailing list