[vtkusers] Buffered Reading of vti File

Grant McAuley gmcauley at llu.edu
Mon Apr 15 14:35:47 EDT 2013


Thanks Karthik, I appreciate your help.  It seems to be working at least in
a simple test case.

The next step seems to be to get the WholeExtent of the data (so I can
determine how to call SetUpdateExtent()).  However, it seems I can't call
GetWholeExtent() until after the Reader is updated?  Ie, doing something
like:
vtkSmartPointer<vtkXMLImageDataReader> reader =
 vtkSmartPointer<vtkXMLImageDataReader>::New();
reader->SetFileName(inputFilename);
reader->Update();
int* we = reader->GetOutput()->GetWholeExtent();
defeats the purpose of a buffered read since the whole file is read.

I was looking for a higher level method, but do I need to read the
'WholeExtent' attribute from the 'ImageData' XML element directly (ie,
interact with the XML parser at a lower level)?  Pardon me if I am missing
something obvious.




On Tue, Apr 9, 2013 at 1:56 AM, Karthik Krishnan <
karthik.krishnan at kitware.com> wrote:

> You can do a buffered reading with VTK xml image formats since a while in
> VTK, including 5.8... here's how. Turn off whole slices and set the update
> extent on the output.
>
> vtkXMLImageDataReader *reader = vtkXMLImageDataReader::New();
> reader->SetFileName( "in.vti" );
> reader->GetOutput()->SetUpdateExtent( 0, 799, 0, 599, 0, 499 );
> reader->SetWholeSlices(0);
> reader->Update();
>
> --
> karthik
>
>
> On Thu, Apr 4, 2013 at 8:10 PM, Kevin H. Hobbs <hobbsk at ohio.edu> wrote:
>
>> On 04/02/2013 08:52 PM, Grant McAuley wrote:
>> > Ok, it seems that using vktXMLImageReader::SetUpdateExtent(int
>> > extent[6]) requires vtk 6.0 ???  Unless I am missing something, the 5.10
>> > docs show a SetUpdateExtent() method only available in data classes (as
>> > a member of vtkDataObject) but not eg vtkXMLImageReader.   I am using
>> > 5.8, but could try 6.0.
>> >
>>
>> Looks like you're right. SetUpdateExtent is defined in vtkAlgorithm in
>> 6.0 and not in 5.8.
>>
>> I've never set the extent on a reader anyway. I always do what I
>> suggested in the first place:
>>
>> reader -> clip -> whatever
>>             ^
>>          [extent]
>>
>>
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> --
> karthik
>



-- 
Grant McAuley
Postdoctoral Fellow
Radiation Research Labs
Radiation Medicine
Loma Linda University
(909) 558-1000 Ext 85173
gmcauley at llu.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130415/52597dbb/attachment.htm>


More information about the vtkusers mailing list