MCPcopy Create free account
hub / github.com/Kitware/VTK / SeekFile

Method SeekFile

IO/Image/vtkImageReader2.cxx:557–595  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

555
556//------------------------------------------------------------------------------
557void vtkImageReader2::SeekFile(int i, int j, int k)
558{
559 std::streamoff startOffset;
560
561 // convert data extent into constants that can be used to seek.
562 startOffset = static_cast<std::streamoff>(i - this->DataExtent[0]) * this->DataIncrements[0];
563
564 if (this->FileLowerLeft)
565 {
566 startOffset += static_cast<std::streamoff>(j - this->DataExtent[2]) * this->DataIncrements[1];
567 }
568 else
569 {
570 startOffset += static_cast<std::streamoff>(this->DataExtent[3] - this->DataExtent[2] - j) *
571 this->DataIncrements[1];
572 }
573
574 // handle three and four dimensional files
575 if (this->GetFileDimensionality() >= 3)
576 {
577 startOffset += static_cast<std::streamoff>(k - this->DataExtent[4]) * this->DataIncrements[2];
578 }
579
580 startOffset += this->GetHeaderSize(k);
581
582 // error checking
583 if (!this->File)
584 {
585 vtkWarningMacro(<< "File must be specified.");
586 return;
587 }
588
589 this->File->seekg(startOffset, ios::beg);
590 if (this->File->fail())
591 {
592 vtkWarningMacro("File operation failed.");
593 return;
594 }
595}
596
597//------------------------------------------------------------------------------
598// This function reads in one data of data.

Callers 1

vtkImageReader2UpdateFunction · 0.80

Calls 1

GetHeaderSizeMethod · 0.95

Tested by

no test coverage detected