------------------------------------------------------------------------------ Exports all the data from the input.
| 122 | //------------------------------------------------------------------------------ |
| 123 | // Exports all the data from the input. |
| 124 | void vtkImageExport::Export(void* output) |
| 125 | { |
| 126 | void* ptr = this->GetPointerToData(); |
| 127 | if (!ptr) |
| 128 | { |
| 129 | // GetPointerToData() outputs an error message. |
| 130 | return; |
| 131 | } |
| 132 | |
| 133 | if (this->ImageLowerLeft) |
| 134 | { |
| 135 | memcpy(output, ptr, this->GetDataMemorySize()); |
| 136 | } |
| 137 | else |
| 138 | { // flip the image when it is output |
| 139 | int* extent = |
| 140 | this->GetInputInformation()->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT()); |
| 141 | int xsize = extent[1] - extent[0] + 1; |
| 142 | int ysize = extent[3] - extent[2] + 1; |
| 143 | int zsize = extent[5] - extent[4] + 1; |
| 144 | int csize = this->GetInput()->GetScalarSize() * this->GetInput()->GetNumberOfScalarComponents(); |
| 145 | |
| 146 | for (vtkIdType i = 0; i < zsize; i++) |
| 147 | { |
| 148 | ptr = static_cast<void*>(static_cast<char*>(ptr) + ysize * xsize * csize); |
| 149 | for (vtkIdType j = 0; j < ysize; j++) |
| 150 | { |
| 151 | ptr = static_cast<void*>(static_cast<char*>(ptr) - xsize * csize); |
| 152 | memcpy(output, ptr, xsize * csize); |
| 153 | output = static_cast<void*>(static_cast<char*>(output) + xsize * csize); |
| 154 | } |
| 155 | ptr = static_cast<void*>(static_cast<char*>(ptr) + ysize * xsize * csize); |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | //------------------------------------------------------------------------------ |
| 161 | // Provides a valid pointer to the data (only valid until the next |
no test coverage detected