[vtkusers] pieces streaming mechanism

Frédéric Speisser frederic.speisser at grooviz.com
Thu Jun 9 05:05:47 EDT 2011


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];

         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();
}

Is somewhere maybe a documentation explaining the mechanism of pieces 
streaming and how to use it ? ...

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 
> <mailto: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 <http://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/9293541a/attachment.htm>


More information about the vtkusers mailing list