void RoiCtrlObj::checkEspiaRoi(const Roi& set_roi, Roi& hw_roi, 
			       Size& det_frame_size, Roi& espia_roi)
{
	DEB_MEMBER_FUNCT();
	DEB_PARAM() << DEB_VAR2(set_roi, hw_roi);

	det_frame_size = hw_roi.getSize();

	bool sg_roi = (!set_roi.isEmpty() && (hw_roi != set_roi));
	if (sg_roi) {
		espia_roi = hw_roi.subRoiAbs2Rel(set_roi);
		int width = set_roi.getSize().getWidth();
		bool horz_match = ((espia_roi.getTopLeft().x == 0) && 
				   (espia_roi.getSize().getWidth() == width));
		sg_roi = (horz_match && ((width % 4) == 0));
	}

	if (sg_roi) {
		DEB_TRACE() << "Horz. aligned roi qualifies for Espia SG!";
		hw_roi = set_roi;
	} else
		espia_roi.reset();

	DEB_RETURN() << DEB_VAR3(hw_roi, det_frame_size, espia_roi);
}
Esempio n. 2
0
void CtImage::applyHard()
{
	DEB_MEMBER_FUNCT();

	if(m_img_type != m_next_image_type)
	  {
	    m_hw_det->setCurrImageType(m_next_image_type);
	    m_img_type = m_next_image_type;
	  }

	m_hw->apply();
	//Add operation into internal header
	CtSaving* saving = m_ct.saving();

	Bin bin;getBin(bin);
	if(!bin.isOne())
	  saving->addToInternalCommonHeader("binning",bin);

	Roi roi;getRoi(roi);
	if(!roi.isEmpty())
	  saving->addToInternalCommonHeader("roi",roi);

	Flip flip;getFlip(flip);
	if(flip.x || flip.y)
	  saving->addToInternalCommonHeader("flip",flip);

	RotationMode rMode;getRotation(rMode);
	if(rMode != Rotation_0)
	  saving->addToInternalCommonHeader("rotation",rMode);
}
Esempio n. 3
0
void CtHwBinRoiFlip::setRoi(Roi& roi, bool round)
{
	DEB_MEMBER_FUNCT();
	DEB_PARAM() << DEB_VAR2(roi,round);

	if (roi.isEmpty())
		THROW_CTL_ERROR(InvalidValue) << "Hardware roi is empty";
	if (!m_max_roi.containsRoi(roi))
		THROW_CTL_ERROR(InvalidValue) << "Roi out of limts";

	if (!m_has_roi) {
		if (!round)
			THROW_CTL_ERROR(NotSupported) << "No hardware roi available";
	}
	else {
		Roi real_roi;
		m_hw_roi->checkRoi(roi, real_roi);
		if ((!round)&&(real_roi!=roi))
			THROW_CTL_ERROR(InvalidValue) << "Given hardware roi not possible";
		if (roi != m_set_roi) {
			m_hw_roi->setRoi(roi);
			m_set_roi= roi;
			_updateSize();
		}
		roi= real_roi;
	}
}
Esempio n. 4
0
void CtSwBinRoiFlip::setRoi(const Roi& roi)
{
	DEB_MEMBER_FUNCT();
	DEB_PARAM() << DEB_VAR1(roi);

	if (roi.isEmpty())
		THROW_CTL_ERROR(InvalidValue) << "Software roi is empty";
	if (!m_max_roi.containsRoi(roi))
		THROW_CTL_ERROR(InvalidValue) << "Roi out of limts";
	m_roi= roi;
}
Esempio n. 5
0
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;
	}
}