<br><br><div class="gmail_quote">On Tue, Jun 1, 2010 at 1:52 PM, José Felipe Vargas Casadiego <span dir="ltr"><<a href="mailto:vargascasadiego@gmail.com">vargascasadiego@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br><br>I'll try to be clearer, but I'm under the impression that what I did is exactly what you fear.<br><br>I don't use the MetaIO/Utilities "Read" method but rather an untouched copy of the read methods contained in vtkImageReader, which allow to take a volume of interest out of a big file without having to load it up into memory. So in a way yes, I bypassed the Utilities/MetaIO library's read methods...<br>

<br>I'm sending as an attachement the code (name's been changed), maybe you'd like to take a look. In any case I'm under the impression that in order to be able to propose this sort of modification to vtk, I'd have to modify the Utilities/MetaIO library. Would that be the case ?<br>
</blockquote><div><br>Thanks Jose:<br><br>I was hoping however that you'd have used the ROI API in MetaIO, already available for streaming, instead of bypassing the library and adding your own seek calls. The methods in question were added last year to the metaio library by Brad Lowecamp.<br>
<br>-------<br>
$ git log Utilities/vtkmetaio/metaImage.h<br><br>    r775 aylward | 2009-02-15 T 23:53:42.473895Z<br>
    ENH: Enhancements to ROI/streaming provided by Brad Lowekamp at NLM<br>
-------<br>
<br>Specifically the API ReadROI(..) should be used. Something like<br><br>  this->MetaImagePtr.ReadROI( indexMin, indexMax, <br>                             this->FileName, true, data->GetScalarPointer(), m_SubSamplingFactor))<br>
<br>This is already employed in ITK's meta image reader to support streaming Read/Write. VTK's reader/writer is still a bit behind.<br><br>You would compute indexMin and indexMax from the requested region. That way, no API need be added to the class. From a user's standpoint, code would look like :<br>
<br>  vtkMetaImageReader *r = vtkMetaImageReader::New();<br>  r->SetFileName( "foo.mha" );<br>  r->GetOutput()->SetExtent( roiExtent );<br>  r->Update();<br>
<br>I would encourage you to take a look at itkMetaImageIO.cxx ( <a href="http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkMetaImageIO.cxx?annotate=1.106&root=Insight">http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/IO/itkMetaImageIO.cxx?annotate=1.106&root=Insight</a> ) to see how we invoke the needed methods in the MetaIO library. <br>
<br>If you send us such a patch, we could add it to vtkMetaImageReader directly. <br><br>Thanks<br>--<br>karthik<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br>Thanks.<br><br><br><div class="gmail_quote">2010/5/31 Karthik Krishnan <span dir="ltr"><<a href="mailto:karthik.krishnan@kitware.com" target="_blank">karthik.krishnan@kitware.com</a>></span><div><div></div><div class="h5">
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="gmail_quote"><div>On Mon, May 31, 2010 at 6:20 PM, José Felipe Vargas Casadiego <span dir="ltr"><<a href="mailto:vargascasadiego@gmail.com" target="_blank">vargascasadiego@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br><br>I needed to read .mhd files and be able to take volumes of interest out of them. With vtkMetaImageReader I could read these files and with vtkImageReader I could obtain the volumes of interest (VOIs) at the expense of having to manually configure the reader. Hence I decided to combine the functionality of both in a new reader, 'till now simply called vtkMyMetaImageReader, inheriting from vtkImageReader2. With it it's possible to automatically read a .mhd file and then read subvolumes of it.<br>



<br>I'd like to know if it'd be possible to add this to vtk. I've checked the website and I wasn't able to find a proper procedure to do it. </blockquote></div><div><br>Jose:<br><br>Thanks.<br><br>If you are looking for an image based file format in VTK that already supports Streaming Input, please take a look at vtkXMLImageDataReader.<br>


 <br>The API is  <br>  vtiReader->GetOutput()->SetExtent( requestedExtent );<br>  vtiReader->Update();<br><br>----<br><br>Could you please send us the patch.<br><br>Have you added the functionality to the MetaIO (third party) library itself ?<br>


<br>It sounds from your email (please correct me if I'm wrong), that you've bypassed the Utilities/MetaIO library's read methods. Do you merely use them to read in the header and then read in the bulk data using your own file-seek methods. If so, it would be very hard for us to support that. The MetaImage library allows one to store the image in a variety of ways (as lists of 2D stacks, compressed with zlib, simple raw), and having the API work for only one case may not be possible.<br>


<br><br>Thanks<br>--<br>karthik</div></div><br>
</blockquote></div></div></div><br><br clear="all"><div><div></div><div class="h5"><br>-- <br>The era of procrastination, of half-measures, of soothing and baffling expedients, of delays, is coming to its close. In its place we are entering a period of consequences<br>

-Winston Churchill<br>
</div></div></blockquote></div><br><br>