void CtImage::setFlip(Flip &flip) { DEB_MEMBER_FUNCT(); DEB_PARAM() << DEB_VAR1(flip); //Get previous roi unflipped Flip currentFlip; getFlip(currentFlip); Roi currentRoi; getRoi(currentRoi); RotationMode currentRotation; getRotation(currentRotation); const Size& max_roi_size = m_hw->getMaxRoiSize(); currentRoi = currentRoi.getUnrotated(currentRotation,max_roi_size); currentRoi = currentRoi.getFlipped(currentFlip,max_roi_size); if(!flip.x && ! flip.y) _resetFlip(); else { switch(m_mode) { case SoftOnly: m_sw->setFlip(flip); break; case HardOnly: m_hw->setFlip(flip,true); break; case HardAndSoft: _setHSFlip(flip); break; } } //Set the previous roi resetRoi(); currentRoi = currentRoi.getFlipped(flip,max_roi_size); currentRoi = currentRoi.getRotated(currentRotation,max_roi_size); setRoi(currentRoi); }
void CtImage::setRoi(Roi& roi) { DEB_MEMBER_FUNCT(); DEB_PARAM() << DEB_VAR1(roi); if (roi.isEmpty()) { resetRoi(); return; } switch (m_mode) { case SoftOnly: m_sw->setRoi(roi); break; case HardOnly: { const Size& max_roi_size = m_hw->getMaxRoiSize(); // Remove the software Rotation to hardware Roi RotationMode aSoftwareRotation = m_sw->getRotation(); roi = roi.getUnrotated(aSoftwareRotation,max_roi_size); // Remove the software Flip to hardware Roi const Flip &aSoftwareFlip = m_sw->getFlip(); roi = roi.getFlipped(aSoftwareFlip,max_roi_size); m_hw->setRoi(roi, false); // Add Flip roi = roi.getFlipped(aSoftwareFlip,max_roi_size); // Add Rotation roi = roi.getRotated(aSoftwareRotation,max_roi_size); } break; case HardAndSoft: _setHSRoi(roi); break; } }