//-----------------------------------------------------
//
//-----------------------------------------------------
void DetInfoCtrlObj::getMaxImageSize(Size& max_image_size)
{
	DEB_MEMBER_FUNCT();
	FrameDim fdim;
	m_adsc.getFrameDim(fdim);
	max_image_size = fdim.getSize();
}
Exemplo n.º 2
0
/***************************************************************//**
 * @brief Checks the consistency of FrameDim, Bin and RoI
 *
 * First checks if Binning is valid
 * Then checks if FrameDim is inside of the MaxImageSize
 * Finally checks if the RoI is consistent with the binned frame dim
 *******************************************************************/
void FrameBuilder::checkValid( const FrameDim &frame_dim, const Bin &bin, 
                               const Roi &roi ) throw(Exception)
{
	Size max_size;
	getMaxImageSize( max_size );

	Bin valid_bin = bin;
	checkBin(valid_bin);
	if (valid_bin != bin)
		throw LIMA_HW_EXC(InvalidValue, "Invalid bin");

	if( (frame_dim.getSize().getWidth()  > max_size.getWidth()) ||
	    (frame_dim.getSize().getHeight() > max_size.getHeight()) )
		throw LIMA_HW_EXC(InvalidValue, "Frame size too big");

	FrameDim bin_dim = frame_dim / bin;

	if( roi.getSize() != 0 ) {
		bin_dim.checkValidRoi(roi);
	}
}
Exemplo n.º 3
0
/***************************************************************//**
 * @brief FrameBuilder class initialiser setting member variables
 *
 * Before setting we check the values for consistency
 *
 * @param[in] frame_dim    The frame dimensions
 * @param[in] roi          RoI in BINNED units
 * @param[in] peaks        A vector of GaussPeak structures
 * @param[in] grow_factor  Peaks grow % with each frame
 *******************************************************************/
void FrameBuilder::init( FrameDim &frame_dim, Bin &bin, Roi &roi,
			 const PeakList &peaks,
			 double grow_factor )
{
	checkValid(frame_dim, bin, roi);
	setPeaks(peaks);

	m_frame_dim = frame_dim;
	m_bin = bin; 
	m_roi = roi;
	
	m_fill_type = Gauss;
	m_rot_axis = RotationY;

	m_grow_factor = grow_factor;
	m_frame_nr = 0;
	m_rot_angle = 0;
	m_rot_speed = 0;
	m_diffract_x = frame_dim.getSize().getWidth() / 2;
	m_diffract_y = frame_dim.getSize().getHeight() / 2;

	m_diffract_sx = 0;
	m_diffract_sy = 0;
}
Exemplo n.º 4
0
void BufferCbMgr::getBufferFrameDim(const FrameDim& single_frame_dim,
				    int nb_concat_frames, 
				    FrameDim& buffer_frame_dim)
{
	DEB_MEMBER_FUNCT();
	DEB_PARAM() << DEB_VAR2(single_frame_dim, nb_concat_frames);

	if (nb_concat_frames < 1) 
		THROW_HW_ERROR(InvalidValue) << "Invalid " 
					     << DEB_VAR1(nb_concat_frames);

	buffer_frame_dim = single_frame_dim;
	Size buffer_size = buffer_frame_dim.getSize();
	buffer_size *= Point(1, nb_concat_frames);
	buffer_frame_dim.setSize(buffer_size);

	DEB_RETURN() << DEB_VAR1(buffer_frame_dim);
}
void SavingCtrlObj::HwSavingStream::writeFrame(HwFrameInfoType& frame_info) {
	DEB_MEMBER_FUNCT();
	try {
		FrameDim fdim = frame_info.frame_dim;
		Size size = fdim.getSize();
		int width = size.getWidth();
		int height = size.getHeight();
        int saveOpt;
        m_cam.getSaveOpt(saveOpt);

		if (height == 1) {
            uint64_t* image_data = (uint64_t*) frame_info.frame_ptr;
	        hsize_t slab_dim[2];
	        slab_dim[1] = width;
	        slab_dim[0] = 1;
	        DataSpace slabspace = DataSpace(RANK_TWO, slab_dim);

	        hsize_t offset[] = { (unsigned) frame_info.acq_frame_nb, 0};
            hsize_t count[] = { 1, (unsigned) width};
            DEB_TRACE() << DEB_VAR4(m_streamNb, frame_info.acq_frame_nb, offset, count);
            m_image_dataspace->selectHyperslab(H5S_SELECT_SET, count, offset);
            m_image_dataset->write(image_data, PredType::NATIVE_UINT64, slabspace, *m_image_dataspace);
		} else {
		    hsize_t slab_dim[3];
            slab_dim[2] = size.getWidth();
            slab_dim[1] = size.getHeight();
            slab_dim[0] = 1;
            DataSpace slabspace = DataSpace(RANK_THREE, slab_dim);

            hsize_t offset[] = { (unsigned) frame_info.acq_frame_nb, 0, 0};
            hsize_t count[] = { 1, (unsigned) width, (unsigned) height };
            DEB_TRACE() << DEB_VAR4(m_streamNb, frame_info.acq_frame_nb, offset, count);
            m_image_dataspace->selectHyperslab(H5S_SELECT_SET, count, offset);
            if (saveOpt & Camera::SaveHistogram && m_streamNb == 2) {
                m_image_dataset->write((uint32_t*) frame_info.frame_ptr, PredType::NATIVE_UINT32, slabspace, *m_image_dataspace);
            } else {
                m_image_dataset->write((uint16_t*) frame_info.frame_ptr, PredType::NATIVE_UINT16, slabspace, *m_image_dataspace);
            }
        }
	}
	catch (H5::Exception &e) {
		THROW_CTL_ERROR(Error) << e.getCDetailMsg();
	}
}