[Insight-developers] PatCh to MetaIO for bug 9766

Bradley Lowekamp blowekamp at mail.nih.gov
Wed Nov 4 11:58:39 EST 2009


Thanks,

	I am not seeing any problems with this patch on the ITK or VTK  
dashboards yet so that is a good sign. I did notice a small problem  
with a subsampling not being  checked in the readLine calculation, but  
I will fix that in the next patch.

I am just double checking some testing for for another patch for bug  
that I run into on OSX, but suspect it probably on other systems too:
http://www.itk.org/Bug/view.php?id=9320

I have two style questions:

1) I need a constant for the maximum file chuck to read ( I am going  
to set it to 1GB ). Currently, I have it as a static constant in  
metaImage.cxx, but should it be some place else.... metaUtils?

2) I also debated about if this tight loop over an stream::read should  
be separated into a function. But after considering the depth of Read  
methods that already exist, I don't think it's necessary. The patch  
basically consists of 5 changes similar to the following:

@@ -3310,9 +3357,18 @@
            }
          else // binary data
            {
-          _fstream->read(data, readLine);
-          gc += _fstream->gcount();
-          data += _fstream->gcount();
+
+          // the data is read with calls no bigger then MaxIOChunk
+          size_t bytesRemaining = readLine;
+          while ( bytesRemaining )
+            {
+            size_t chunkToRead = bytesRemaining > MaxIOChunk ?  
MaxIOChunk : bytesRemaining;
+            _fstream->read( (char *)data, chunkToRead );
+            data = (char *)(data) + chunkToRead; // <- Note: _data is  
changed
+            bytesRemaining -= chunkToRead;
+            gc += _fstream->gcount();
+            }
+
            }
          }

Brad


On Nov 3, 2009, at 8:31 PM, Julien Jomier wrote:

> Hi Brad,
>
> Sorry for the late reply. I just submitted the patch. Feel free to
> resolve/close the bug as necessary.
>
> Julien
>

========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20091104/1e8a4a9f/attachment.htm>


More information about the Insight-developers mailing list