| 80 | } |
| 81 | |
| 82 | void IPImageViewer::updateImage() |
| 83 | { |
| 84 | if(_processStep && _processStep->process() && _processStep->process()->isResultReady()) |
| 85 | { |
| 86 | // delete last image |
| 87 | delete _image; |
| 88 | _image = NULL; |
| 89 | |
| 90 | _rawData = NULL; |
| 91 | _rawImage = NULL; |
| 92 | |
| 93 | // convert from IPLImage |
| 94 | _rawData = _processStep->process()->getResultData(_resultIndex); |
| 95 | |
| 96 | // if the result is invalid, abort |
| 97 | if(!_rawData) |
| 98 | { |
| 99 | setVisible(false); |
| 100 | _imageViewerWindow->updateHistogram(NULL); |
| 101 | _imageViewerWindow->updateStatistics(NULL); |
| 102 | _imageViewerWindow->updateZoomwidget(NULL); |
| 103 | return; |
| 104 | } |
| 105 | else |
| 106 | { |
| 107 | setVisible(true); |
| 108 | } |
| 109 | |
| 110 | if(_rawData->type() == IPL_IMAGE_COLOR |
| 111 | || _rawData->type() == IPL_IMAGE_GRAYSCALE |
| 112 | || _rawData->type() == IPL_IMAGE_BW |
| 113 | || _rawData->type() == IPL_IMAGE_ORIENTED |
| 114 | ) |
| 115 | { |
| 116 | _rawImage = _rawData->toImage(); |
| 117 | |
| 118 | // show normal image |
| 119 | _image = new QImage(_rawImage->rgb32(), _rawImage->width(), _rawImage->height(), QImage::Format_RGB32); |
| 120 | } |
| 121 | else if(_rawData->type() == IPL_IMAGE_COMPLEX) |
| 122 | { |
| 123 | _rawComplexImage = _rawData->toComplexImage(); |
| 124 | |
| 125 | // show complex image |
| 126 | _image = new QImage(_rawComplexImage->rgb32(), _rawComplexImage->width(), _rawComplexImage->height(), QImage::Format_RGB32); |
| 127 | } |
| 128 | else if(_rawData->type() == IPL_POINT) |
| 129 | { |
| 130 | // show point |
| 131 | _rawData = _processStep->process()->getResultData(0); |
| 132 | _image = new QImage(_rawData->toImage()->rgb32(), _rawData->toImage()->width(), _rawData->toImage()->height(), QImage::Format_RGB32); |
| 133 | |
| 134 | QPainter painter(_image); |
| 135 | painter.setRenderHint(QPainter::Antialiasing, true); |
| 136 | |
| 137 | IPLPoint* p = _processStep->process()->getResultData(1)->toPoint(); |
| 138 | |
| 139 | QPoint point; |
no test coverage detected