//TO-DO test for all types once instantiated
		void testCovolutionFullPixelOneBand() {
			std::cout << std::endl << "GPU CONV VERIFICATION TEST" << std::endl;
			ssize_t filterRadius = 1;
			cv::Size2i roi(5,5);
			cv::Size2i dSize(roi.width + filterRadius * 2,roi.height + filterRadius * 2);
			vector<short> data;
			data.resize(dSize.area());

			for(int i = 0; i < dSize.area(); ++i) {
				data[i] = i;
			}

			cvt::cvTile<short> inTile(data.data(), dSize, 1);
			cvt::cvTile<short>* outTile;

			cv::Mat weightsMat = cv::Mat::zeros(3,3,CV_16UC1);
			for(int i = 0; i < 3; ++i) {
				for(int j = 0; j < 3; ++j) {
					weightsMat.at<short>(i,j) = 2;
				}
			}
			
			inTile.setROI(cv::Rect(filterRadius, filterRadius, roi.width, roi.height));	
			cvt::gpu::GpuConvolution<short,1,short,1,short> conv(0, roi.width, roi.height,
									    filterRadius, weightsMat);

			TS_ASSERT_EQUALS(cvt::Ok, conv.initializeDevice(cvt::gpu::SQUARE));
			
			conv(inTile, (const cvt::cvTile<short>**)&outTile);
			TS_ASSERT_EQUALS(0, (outTile == NULL));

			//TODO Can we remove this?
			//cv::Mat& a = inTile[0];
			cv::Mat& b = (*outTile)[0];

			short expected[] = {32, 54, 66, 78, 
					  90, 102, 72, 90, 
					  144, 162, 180, 198, 
					  216, 150, 174, 270, 
					  288, 306, 324, 342,
					  234, 258, 396, 414, 432};

			int k = 0;
			for(int i = 0; i < roi.width; ++i) {
				for(int j = 0; j < roi.height; ++j) {
					//std::cout << "b[" << i << "," << j << "] = " << b.at<short>(i,j) << std::endl;
					TS_ASSERT_EQUALS(b.at<short>(i,j), expected[k]);
					k++;
				}
			}
	}
//-------------------------------------------------------------------------
void QGuidoItemContainer::resized(const QRectF& newRect)
{
	if ( newRect.toRect() == rect().toRect() )
		return;

	
	if ( mResizeMode == RESIZE_GRID )
	{
		QRectF oldRect = rect();
		mGuidoItem->setGridWidth( mGuidoItem->gridWidth() * newRect.width() / rect().width() + 0.5f );
		mGuidoItem->setGridHeight( mGuidoItem->gridHeight() * newRect.height() / rect().height() + 0.5f );
		guidoGeometryChanged();
		
		QSizeF dSize( rect().size() - oldRect.size() );
		moveBy( dSize.width() * ( newRect.x() ? -1 : 0 ) , dSize.height() * ( newRect.y() ? -1 : 0 ) );
	}
	else if ( mResizeMode == RESIZE_FORMAT )
	{
		QRectF oldRect = rect();
	
		GuidoPageFormat f = mGuidoItem->guidoPageFormat();
		f.width = f.width * newRect.width() / rect().width();
		f.height = f.height * newRect.height() / rect().height();
		mGuidoItem->setGuidoPageFormat(f);

		//Control if how the page format was actually supported,
		//and set it to its actual value.
		if ( rect().toRect() != newRect.toRect() )	//has use int comparison, float isn't reliable
		{
			f = mGuidoItem->guidoPageFormat();
			f.width = f.width * rect().width() / newRect.width();
			f.height = f.height * rect().height() / newRect.height();
			mGuidoItem->setGuidoPageFormat(f);
		}
		
		QSizeF dSize( rect().size() - oldRect.size() );
		
//		moveBy( newRect.x() , newRect.y() );
		moveBy( dSize.width() * ( newRect.x() ? -1 : 0 ) , dSize.height() * ( newRect.y() ? -1 : 0 ) );
	}
	else
	{
		float xScale = mGuidoItem->transform().m11();
		float yScale = mGuidoItem->transform().m22();

		float dx = newRect.x();
		float dy = newRect.y();

		float sx = ( newRect.width() / rect().width() );
		float sy = ( newRect.height() / rect().height() );

		float boundedSx = sx;
		float boundedSy = sy;

		if ( mMaxScale )
			boundedSx = qMin( mMaxScale/xScale , boundedSx );
		boundedSx = qMax( mMinScale/xScale , boundedSx );
		if ( mMaxScale )
			boundedSy = qMin( mMaxScale/yScale , boundedSy );
		boundedSy = qMax( mMinScale/yScale , boundedSy );

		dx = dx * (boundedSx - 1 ) / ( sx - 1 );
		dy = dy * (boundedSy - 1 ) / ( sy - 1 );
		
		moveBy( dx , dy );
		
		mGuidoItem->scale( boundedSx , boundedSy );
		guidoGeometryChanged();

		Q_EMIT scaleChanged( mGuidoItem->transform().m11() );
	}
	mResizeMode = RESIZE_NORMAL;
	if ( mResizer )
		mResizer->setKeepAspectRatio(true);
}