Ejemplo n.º 1
0
bool LayerCollection::AddLayer( Layer* layer, bool initializeCoordinate )
{
  if ( !layer->IsTypeOf( m_strType ) )
  {
    std::cerr << "Can not add layer type of " << qPrintable(layer->GetEndType())
              << " to layer collection type of " <<  qPrintable(m_strType) << "\n";
    return false;
  }

  Layer* old_top = (m_layers.isEmpty() ? NULL : m_layers[0]);
  for ( int i = 0; i < m_layers.size(); i++ )
  {
    if ( m_layers[i] == layer )
    {
      return false;
    }
  }

  if ( initializeCoordinate)
  {
    layer->GetSlicePosition( m_dSlicePosition );
    layer->GetWorldOrigin( m_dWorldOrigin );
    layer->GetWorldSize( m_dWorldSize );
    layer->GetWorldVoxelSize( m_dWorldVoxelSize );
  }
  else
  {
    layer->SetSlicePosition( m_dSlicePosition );
  }

  m_layers.insert( m_layers.begin(), layer );
  connect( layer, SIGNAL(ActorUpdated()), this, SIGNAL(LayerActorUpdated()) );
  connect( layer, SIGNAL(Transformed()), this, SIGNAL(LayerActorUpdated()) );
  connect( layer, SIGNAL(ActorChanged()), this, SIGNAL(LayerActorChanged()) );
  connect( layer, SIGNAL(NameChanged(QString)), this, SIGNAL(LayerNameChanged()));
  connect(layer, SIGNAL(Transformed()), this, SIGNAL(LayerTransformed()));
  if (layer->IsTypeOf("Editable"))
    connect( layer, SIGNAL(Modified()), this, SIGNAL(LayerModified()));
  if (layer->GetProperty())
  {
    connect( layer->GetProperty(), SIGNAL(PropertyChanged()), this, SIGNAL(LayerPropertyChanged()));
    connect( layer->GetProperty(), SIGNAL(ShowInfoChanged(bool)), this, SIGNAL(LayerShowInfoChanged()));
  }
Ejemplo n.º 2
0
void polygonGate::transforming(trans_local & trans){
	if(!Transformed())
	{
		vector<coordinate> vertices=param.getVertices();
		/*
		 * get channel names to select respective transformation functions
		 */
		string channel_x=param.xName();
		string channel_y=param.yName();

		//get vertices in valarray format
		vertices_valarray vert(vertices);

		/*
		 * do the actual transformations
		 */
		transformation * trans_x=trans.getTran(channel_x);
		transformation * trans_y=trans.getTran(channel_y);


		if(trans_x!=NULL)
		{
			if(g_loglevel>=POPULATION_LEVEL)
				COUT<<"transforming: "<<channel_x<<endl;;
	//		valarray<double> output_x(trans_x->transforming(vert.x));
			trans_x->transforming(vert.x);
			for(unsigned i=0;i<vertices.size();i++)
	//			vertices.at(i).x=output_x[i];// yodate coordinates-based vertices
				vertices.at(i).x=vert.x[i];
		}
		if(trans_y!=NULL)
		{
			if(g_loglevel>=POPULATION_LEVEL)
				COUT<<"transforming: "<<channel_y<<endl;;
	//		valarray<double> output_y(trans_y->transforming(vert.y));
			trans_y->transforming(vert.y);
			for(unsigned i=0;i<vertices.size();i++)
	//			vertices.at(i).y=output_y[i];
				vertices.at(i).y=vert.y[i];
		}
		if(g_loglevel>=POPULATION_LEVEL)
			COUT<<endl;
		param.setVertices(vertices);
		isTransformed=true;
	}
}
Ejemplo n.º 3
0
/*
 * we moved the interpolation to polygonGate form gating method to here because
 * gating may not be called when only gates to be extracted
 */
void ellipseGate::transforming(trans_local & trans){
	if(!Transformed())
	{
		/*
		 * get channel names to select respective transformation functions
		 */
		string channel_x=param.xName();
		string channel_y=param.yName();

		//get vertices in valarray format
		vertices_valarray vert(antipodal_vertices);

		/*
		 * do the actual transformations
		 */
		transformation * trans_x=trans.getTran(channel_x);
		transformation * trans_y=trans.getTran(channel_y);


		if(trans_x!=NULL)
		{
			if(g_loglevel>=POPULATION_LEVEL)
				COUT<<"transforming: "<<channel_x<<endl;;

			trans_x->transforming(vert.x);
			for(unsigned i=0;i<antipodal_vertices.size();i++)
				antipodal_vertices.at(i).x=vert.x[i];
		}
		if(trans_y!=NULL)
		{
			if(g_loglevel>=POPULATION_LEVEL)
				COUT<<"transforming: "<<channel_y<<endl;;

			trans_y->transforming(vert.y);
			for(unsigned i=0;i<antipodal_vertices.size();i++)
				antipodal_vertices.at(i).y=vert.y[i];
		}
		if(g_loglevel>=POPULATION_LEVEL)
			COUT<<endl;

		computeCov();
		isTransformed=true;
	}
}
Ejemplo n.º 4
0
void rangeGate::transforming(trans_local & trans){
	if(!Transformed())
	{
		vertices_valarray vert(getVertices());

		transformation * curTrans=trans.getTran(param.getName());
		if(curTrans!=NULL)
		{
			if(g_loglevel>=POPULATION_LEVEL)
				COUT<<"transforming "<<param.getName()<<endl;
	//		valarray<double> output(curTrans->transforming(vert.x));
	//		param.min=output[0];
	//		param.max=output[1];
			curTrans->transforming(vert.x);
			param.setMin(vert.x[0]);
			param.setMax(vert.x[1]);
		}
		isTransformed=true;
	}

}
Ejemplo n.º 5
0
 static Transformed pre(Exposed&) { return Transformed(); }
Ejemplo n.º 6
0
 static Transformed pre(Exposed& val) 
 { 
     return Transformed(traits::extract_from<Transformed>(val, unused));
 }
Ejemplo n.º 7
0
 static Transformed& pre(boost::optional<Exposed>& val)
 {
     if (!val)
         val = Transformed();
     return boost::get<Transformed>(val);
 }
Ejemplo n.º 8
0
 static Transformed pre(Exposed& val) { return Transformed(val); }
Ejemplo n.º 9
0
/*
 * ellipsoidGate does not follow the regular transforming process
 * for historical reason, it is defined in 256 * 256 scale, and we don't know
 * how to translate it to the transformed scale yet, thus simply throw exception
 * for the EllipsoidGate defined on the non-linear data channel
 * for linear channels, we will do the same rescaling here.
 */
void ellipsoidGate::transforming(trans_local & trans){

	if(!Transformed())
	{
		/*
		 * get channel names to select respective transformation functions
		 */
		string channel_x=param.xName();
		string channel_y=param.yName();

		//get vertices in valarray format
		vertices_valarray vert(antipodal_vertices);


		transformation * trans_x=trans.getTran(channel_x);
		transformation * trans_y=trans.getTran(channel_y);


		/*
		 * we don't know the exact scaling rules for ellipsoidGate of non-linear space yet
		 * so simply throws error for now
		 */
		string err="Don't know how to scale the ellipsoidGate on the non-linear data space: ";
		if(trans_x==NULL)
		{
			//do the special scaling first for linear ellipsoidGate
			scaleTrans scale_f(1024);//assuming the max value is always 262144, thus 262144/256 = 1024
			if(g_loglevel>=POPULATION_LEVEL)
				COUT<<"scaling: "<<channel_x<<endl;;

			scale_f.transforming(vert.x);
			for(unsigned i=0;i<antipodal_vertices.size();i++)
				antipodal_vertices.at(i).x=vert.x[i];
		}
		else
		{
			err.append(channel_x);
			throw(domain_error(err));
		}

		if(trans_y==NULL)
		{
			//do the special scaling first for linear ellipsoidGate
			scaleTrans scale_f(1024);//assuming the max value is always 262144, thus 262144/256 = 1024
			if(g_loglevel>=POPULATION_LEVEL)
				COUT<<"scaling: "<<channel_y<<endl;;

			scale_f.transforming(vert.y);
			for(unsigned i=0;i<antipodal_vertices.size();i++)
				antipodal_vertices.at(i).y=vert.y[i];
		}
		else
		{
			err.append(channel_y);
			throw(domain_error(err));
		}

		if(g_loglevel>=POPULATION_LEVEL)
			COUT<<endl;

		computeCov();
		isTransformed=true;
	}

}
Ejemplo n.º 10
0
OBoundingBox OBoundingBox::Transformed(const OMatrix3x3& transform) const
{
	return Transformed(OMatrix3x4(transform));
}
Ejemplo n.º 11
0
void OBoundingBox::Transform(const OMatrix3x4& transform)
{
	*this = Transformed(transform);
}
Ejemplo n.º 12
0
BoundingBox BoundingBox::Transformed(const Matrix3& transform) const
{
    return Transformed(Matrix3x4(transform));
}
Ejemplo n.º 13
0
void BoundingBox::Transform(const Matrix3& transform)
{
    *this = Transformed(Matrix3x4(transform));
}