- uint32_t dummy = 0x12345678;
- size_t offset = fp->tellp();
- JpegPair jp;
- jp.first = offset;
- v.push_back(jp);
- gdcm::binary_write(*fp, dummy);
+ uint32_t item_length = numFrag*4; // sizeof(uint32_t)
+ gdcm::binary_write(*fp, item_length);
+
+ // Just prepare the space
+ start = fp->tellp(); //to be able to rewind
+ for(int i=0; i<numFrag;++i)
+ {
+ uint32_t dummy = 0x0000;
+ gdcm::binary_write(*fp, dummy);
+ }
+}
+
+void UpdateBasicOffsetTable(std::ostream *fp, JpegVector const &v, size_t pos)
+{
+ JpegVector::const_iterator i;
+ fp->seekp( pos );
+ const JpegPair &first = v[0];
+ for(i=v.begin(); i!=v.end(); ++i)
+ {
+ const JpegPair &jp = *i;
+ if(i == v.begin() ){ assert( jp.first - first.first == 0); }
+ gdcm::binary_write(*fp, jp.first - first.first);
+ std::cerr << "Updating Table:" << jp.first - first.first << std::endl;
+ }