* Sets up the export process with the parameters described within the given * description. * * This method determines determines whether to write the data as grayscale, * RGB, or RGBA. It then opens a cube for retrieving the input data and * establishing the dimensions of the output image. Next, the ProcessExport * format is set to BIL and the ProcessExport output pixel type, out
| 253 | * @return A cube pointer to the first channel created, owned by the process |
| 254 | */ |
| 255 | Cube *ImageExporter::initializeProcess() { |
| 256 | switch (m_exportDescription->channelCount()) { |
| 257 | case 1: |
| 258 | m_writeMethod = &ImageExporter::writeGrayscale; |
| 259 | break; |
| 260 | case 3: |
| 261 | m_writeMethod = &ImageExporter::writeRgb; |
| 262 | break; |
| 263 | case 4: |
| 264 | m_writeMethod = &ImageExporter::writeRgba; |
| 265 | break; |
| 266 | default: |
| 267 | throw IException(IException::Programmer, |
| 268 | "Cannot export an image with [" + QString::number(m_exportDescription->channelCount()) + |
| 269 | "] channels", |
| 270 | _FILEINFO_); |
| 271 | } |
| 272 | |
| 273 | ProcessExport &p = process(); |
| 274 | Cube *cube = addChannel(0); |
| 275 | m_samples = cube->sampleCount(); |
| 276 | m_lines = cube->lineCount(); |
| 277 | m_bands = m_exportDescription->channelCount(); |
| 278 | |
| 279 | for (int i = 1; i < m_exportDescription->channelCount(); i++) addChannel(i); |
| 280 | |
| 281 | p.setFormat(ProcessExport::BIL);// why BIL and not default to BSQ??? Doesn't appear to make a |
| 282 | // difference in output images |
| 283 | |
| 284 | // set up the output pixel type, special pixels and valid output range for |
| 285 | // the stretch that will be performed by ProcessExport |
| 286 | p.SetOutputType(exportDescription().pixelType()); |
| 287 | p.SetOutputRange(m_exportDescription->outputPixelValidMin(), |
| 288 | m_exportDescription->outputPixelValidMax()); |
| 289 | |
| 290 | // the dafault value for the null |
| 291 | p.SetOutputNull(m_exportDescription->outputPixelNull()); |
| 292 | |
| 293 | // set the absolute min/max values for all pixels (including specials) in the output image |
| 294 | setOutputPixelRange(m_exportDescription->outputPixelAbsoluteMin(), |
| 295 | m_exportDescription->outputPixelAbsoluteMax()); |
| 296 | return cube; |
| 297 | } |
| 298 | |
| 299 | |
| 300 | /** |
nothing calls this directly
no test coverage detected