------------------------------------------------------------------------------ Structured data is trickier. Which files to load?
| 877 | //------------------------------------------------------------------------------ |
| 878 | // Structured data is trickier. Which files to load? |
| 879 | int vtkPDataSetReader::ImageDataExecute( |
| 880 | vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) |
| 881 | { |
| 882 | vtkInformation* info = outputVector->GetInformationObject(0); |
| 883 | vtkImageData* output = vtkImageData::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT())); |
| 884 | |
| 885 | vtkStructuredPointsReader* reader; |
| 886 | int uExt[6]; |
| 887 | int ext[6]; |
| 888 | int i, j; |
| 889 | |
| 890 | // Allocate the data object. |
| 891 | int wUExt[6]; |
| 892 | info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), wUExt); |
| 893 | vtkNew<vtkExtentTranslator> et; |
| 894 | et->SetWholeExtent(wUExt); |
| 895 | et->SetPiece(info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER())); |
| 896 | et->SetNumberOfPieces(info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES())); |
| 897 | int ghostLevels = info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS()); |
| 898 | et->SetGhostLevel(ghostLevels); |
| 899 | et->PieceToExtent(); |
| 900 | et->GetExtent(uExt); |
| 901 | output->SetExtent(uExt); |
| 902 | output->AllocateScalars(info); |
| 903 | |
| 904 | // Get the pieces that will be read. |
| 905 | std::vector<int> pieceMask(this->NumberOfPieces, 0); |
| 906 | this->CoverExtent(uExt, pieceMask.data()); |
| 907 | |
| 908 | // Now read and append |
| 909 | reader = vtkStructuredPointsReader::New(); |
| 910 | reader->ReadAllScalarsOn(); |
| 911 | reader->ReadAllVectorsOn(); |
| 912 | reader->ReadAllNormalsOn(); |
| 913 | reader->ReadAllTensorsOn(); |
| 914 | reader->ReadAllColorScalarsOn(); |
| 915 | reader->ReadAllTCoordsOn(); |
| 916 | reader->ReadAllFieldsOn(); |
| 917 | for (i = 0; i < this->NumberOfPieces; ++i) |
| 918 | { |
| 919 | if (pieceMask[i]) |
| 920 | { |
| 921 | reader->SetFileName(this->PieceFileNames[i]); |
| 922 | reader->Update(); |
| 923 | // Sanity check: extent is correct. Ignore electric slide. |
| 924 | reader->GetOutput()->GetExtent(ext); |
| 925 | if (ext[1] - ext[0] != this->PieceExtents[i][1] - this->PieceExtents[i][0] || |
| 926 | ext[3] - ext[2] != this->PieceExtents[i][3] - this->PieceExtents[i][2] || |
| 927 | ext[5] - ext[4] != this->PieceExtents[i][5] - this->PieceExtents[i][4]) |
| 928 | { |
| 929 | vtkErrorMacro("Unexpected extent in VTK file: " << this->PieceFileNames[i]); |
| 930 | } |
| 931 | else |
| 932 | { |
| 933 | // Reverse the electric slide. |
| 934 | reader->GetOutput()->SetExtent(this->PieceExtents[i]); |
| 935 | // Intersect extent and output extent |
| 936 | reader->GetOutput()->GetExtent(ext); |
no test coverage detected