------------------------------------------------------------------------------
| 142 | |
| 143 | //------------------------------------------------------------------------------ |
| 144 | int vtkVolume16Reader::RequestData(vtkInformation* vtkNotUsed(request), |
| 145 | vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector) |
| 146 | { |
| 147 | int first, last; |
| 148 | int* dim; |
| 149 | int dimensions[3]; |
| 150 | double Spacing[3]; |
| 151 | double origin[3]; |
| 152 | |
| 153 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 154 | vtkDataObject* output_do = outInfo->Get(vtkDataObject::DATA_OBJECT()); |
| 155 | vtkImageData* output = this->AllocateOutputData(output_do, outInfo); |
| 156 | vtkUnsignedShortArray* newScalars = |
| 157 | vtkArrayDownCast<vtkUnsignedShortArray>(output->GetPointData()->GetScalars()); |
| 158 | |
| 159 | // Validate instance variables |
| 160 | if (this->FilePrefix == nullptr) |
| 161 | { |
| 162 | vtkErrorMacro(<< "FilePrefix is nullptr"); |
| 163 | return 1; |
| 164 | } |
| 165 | |
| 166 | if (this->HeaderSize < 0) |
| 167 | { |
| 168 | vtkErrorMacro(<< "HeaderSize " << this->HeaderSize << " must be >= 0"); |
| 169 | return 1; |
| 170 | } |
| 171 | |
| 172 | dim = this->DataDimensions; |
| 173 | |
| 174 | if (dim[0] <= 0 || dim[1] <= 0) |
| 175 | { |
| 176 | vtkErrorMacro(<< "x, y dimensions " << dim[0] << ", " << dim[1] << "must be greater than 0."); |
| 177 | return 1; |
| 178 | } |
| 179 | |
| 180 | if ((this->ImageRange[1] - this->ImageRange[0]) <= 0) |
| 181 | { |
| 182 | this->ReadImage(this->ImageRange[0], newScalars); |
| 183 | } |
| 184 | else |
| 185 | { |
| 186 | first = this->ImageRange[0]; |
| 187 | last = this->ImageRange[1]; |
| 188 | this->ReadVolume(first, last, newScalars); |
| 189 | } |
| 190 | |
| 191 | // calculate dimensions of output from data dimensions and transform |
| 192 | this->ComputeTransformedDimensions(dimensions); |
| 193 | output->SetDimensions(dimensions); |
| 194 | |
| 195 | // calculate spacing of output from data spacing and transform |
| 196 | this->ComputeTransformedSpacing(Spacing); |
| 197 | |
| 198 | // calculate origin of output from data origin and transform |
| 199 | this->ComputeTransformedOrigin(origin); |
| 200 | |
| 201 | // adjust spacing and origin if spacing is negative |
nothing calls this directly
no test coverage detected