//----------------------------------------------------------------------------------
//! Constructor
//----------------------------------------------------------------------------------
CalcCodedSegmentation::CalcCodedSegmentation (void) : BaseOp(1, 1)
{
  ML_TRACE_IN("CalcCodedSegmentation::CalcCodedSegmentation()")

  FieldContainer *fields = getFieldContainer();

  // Suppress calls of handleNotification on field changes.
  handleNotificationOff();

  MAX_SIZE = SHRT_MAX; //32767

  _fld_Add = fields->addNotify("Add");  
  (_fld_NameToAdd = fields->addString("NameToAdd"))->setStringValue("");
  (_fld_addMinValue = fields->addInt("addMinValue"))->setIntValue(1);
  (_fld_addMaxValue = fields->addInt("addMaxValue"))->setIntValue(ML_INT_MAX);
  (_fld_addAllExceptNull = fields->addBool("addAllExceptNull"))->setBoolValue(false);
  _fld_Reset = fields->addNotify("Reset");
  _fld_Purge = fields->addNotify("Purge");
  _fld_Finish = fields->addNotify("Finish");
  (_fld_ImageValues = fields->addString("ImageValues"))->setStringValue("");
  (_fld_ObjectValues = fields->addString("ObjectValues"))->setStringValue("");

  //All pointer values need to be set NULL here, before reset, otherwise, default random values of pointe can be interpreted as real values and a non existing pointer is tried to delete ... uuhhhh
  _virtualVolume = NULL;
  replaceValues = NULL;
  objectValues = NULL;
  valuesForObjects = NULL;
  objectNames = NULL;

  reset();

  // Reactivate calls of handleNotification on field changes.
  handleNotificationOn();
}
//----------------------------------------------------------------------------------
//! Constructor
//----------------------------------------------------------------------------------
WEMCMSelectPatches::WEMCMSelectPatches (std::string type)
  : WEMProcessor(type, false)
{
  ML_TRACE_IN("WEMCMSelectPatches::WEMCMSelectPatches()")

  FieldContainer *fields = getFieldContainer();
  ML_CHECK(fields);

  // Suppress calls of hanbdleNotification on field changes.
  handleNotificationOff();

  // WEM Patch start and end index field
  _patchStartIndexFld = fields->addInt("patchStartIndex");
  _patchStartIndexFld->setIntValue(0);
  _patchEndIndexFld = fields->addInt("patchEndIndex");
  _patchEndIndexFld->setIntValue(0);

  // Bool field to enable to select only one patch based on start index value
  _onePatchFld = fields->addBool("onePatch");
  _onePatchFld->setBoolValue(false);
  
  // Set auto apply fields
  _autoApplyFld->setBoolValue(true);

  _notifyFld = fields->addNotify("notify");
 
  // Reactivate calls of handleNotification on field changes.
  handleNotificationOn();
}
//----------------------------------------------------------------------------------
//! Constructor
//----------------------------------------------------------------------------------
WEMNodesToFile::WEMNodesToFile (std::string type)
  : WEMInspector(type)
{
  ML_TRACE_IN("WEMNodesToFile::WEMNodesToFile()")

  FieldContainer *fields = getFieldContainer();
  ML_CHECK(fields);

  // Suppress calls of handleNotification on field changes.
  handleNotificationOff();

  // Add filename field
  _filenameFld = fields->addString("filename");
  _filenameFld->setStringValue("");

  // Add transformix option field
  _transformixCompatibleFld = fields->addBool("transformixCompatible");
  _transformixCompatibleFld->setBoolValue(false);

  // Add save button
  _saveFld = fields->addNotify("save");

  // Reactivate calls of handleNotification on field changes.
  handleNotificationOn();
}
//----------------------------------------------------------------------------------
//! Constructor
//----------------------------------------------------------------------------------
METKAutoFading::METKAutoFading (void) : inherited(0,0,ObjMgrClient::EVENTS_SELECTED)
{
	ML_TRACE_IN("METKAutoFading::METKAutoFading()")

	myObjMgr = new ObjMgrCommunicator();
	myCamera = new kCamera();

	FieldContainer *fields = getFieldContainer();

	// Suppress calls of handleNotification on field changes.
	handleNotificationOff();

	_outScene = getFieldContainer()->addSoNode("outScene");
	(_EnableFading = fields->addBool("EnableFading"))->setBoolValue(FALSE);	
	(_UseMETKValues = fields->addBool("UseMETKValues"))->setBoolValue(FALSE);
	(_CurrentObject = fields->addString("CurrentObject"))->setStringValue("");
	(_ViewerName = fields->addString("ViewerName"))->setStringValue("METKViewer3D");
	_init = fields->addNotify("init");
	_calc = fields->addNotify("calc");
	(_dataPath = fields->addString("dataPath"))->setStringValue("");
	_similarPosition = fields->addVec3f("similarPosition");
	_camPosition = fields->addVec3f("camPosition");
	_camOrientation = fields->addVec4f("camOrientation");	

	setAcceptedEvents();

	m_soViewer = new SoVisDataViewer();
	_outScene->setSoNodeValue(m_soViewer);


	oReceiver = new METKMsgReceiver();
    oReceiver->messageFld->setStringValue("fading");
	/*_message = (StringField*) getFieldContainer()->addField(oReceiver->getFieldContainer()->getField("message"));
	_messageData = (StringField*) getFieldContainer()->addField(oReceiver->getFieldContainer()->getField("data"));*/
	_message = getFieldContainer()->addString("message");
	oReceiver->messageFld->attachField(_message,0);
	_messageData = getFieldContainer()->addString("data");
	oReceiver->getFieldContainer()->getField("data")->attachField(_messageData,0);
    timerSensor = new SoTimerSensor((SoSensorCB*)METKAutoFading::timerEvent, this);
    timerSensor->setInterval(SbTime(1.0/1000.0));
    timerSensor->unschedule();


	// Reactivate calls of handleNotification on field changes.
	handleNotificationOn();
}
//----------------------------------------------------------------------------------
//! Constructor
//----------------------------------------------------------------------------------
CSOPointsToXMarkers::CSOPointsToXMarkers (void)
  : BaseOp(0, 0), _inputCSOList(NULL)
{
  ML_TRACE_IN("CSOPointsToXMarkers::CSOPointsToXMarkers()")

  FieldContainer *fields = getFieldContainer();

  // Suppress calls of handleNotification on field changes.
  handleNotificationOff();

  // Input CSO List field
  _inputCSOListFld = fields->addBase("inputCSOList");
  _inputCSOListFld->setBaseValue(NULL);

  // Output XMarkerList field
  _outputXMarkerListFld = fields->addBase("outputXMarkerList");
  _outputXMarkerListFld->setBaseValue(&_outputXMarkerList);
  
  // List index field
  _listIndexFld = fields->addInt("listIndexFld");
  _listIndexFld->setIntValue(0);

  // Bool to enable/disable to also export the path points
  _convertPathPoints=fields->addBool("convertPathPoints");

  // Bool to enable/disable to export CSO normals
  _outputCSONormals = fields->addBool("outputCSONormals");
  _outputCSONormals->setBoolValue(false);

  // Bool, if checked the cso id is put in the marker type
  // (instead of the conventional index)
  _setIdInMarkerTypeFld = fields->addBool("setIdInMarkerType");
  _setIdInMarkerTypeFld->setBoolValue(false);

  // Reactivate calls of handleNotification on field changes.
  handleNotificationOn();
}
//----------------------------------------------------------------------------------
//! Constructor
//----------------------------------------------------------------------------------
WEMCenterOfMass::WEMCenterOfMass (std::string type)
  : WEMInspector(type)
{
  ML_TRACE_IN("WEMCenterOfMass::WEMCenterOfMass()")

  FieldContainer *fieldC = getFieldContainer();
  ML_CHECK(fieldC);

  // Suppress calls of handleNotification on field changes.
  handleNotificationOff();

  // Add output fields
  _centerOfMass = fieldC->addVec3f("centerOfMass");
  _centerOfMass->setVec3fValue(vec3(0.0,0.0,0.0));
  _inverseCenterOfMass = fieldC->addVec3f("inverseCenterOfMass");
  _inverseCenterOfMass->setVec3fValue(vec3(0.0,0.0,0.0));

  _useSurface = fieldC->addBool("useSurface");
  _useSurface->setBoolValue( false );

  // Reactivate calls of handleNotification on field changes.
  handleNotificationOn();
}
예제 #7
0
//----------------------------------------------------------------------------------
//! Constructor
//----------------------------------------------------------------------------------
SyncFields::SyncFields ()
  : BaseOp(0, 0)
{
  ML_TRACE_IN("SyncFields::SyncFields ()");

  handleNotificationOff();
  FieldContainer *fieldC = getFieldContainer();

  const char* syncModes[] = {"Float","MultiFloat","Vector","MultiVector"};
  f_Mode = fieldC->addEnum("mode",syncModes,4);
  f_Mode->setEnumValue( FLOAT );

  f_On = fieldC->addBool("on");
  f_On->setBoolValue( true );

  f_Precision = fieldC->addDouble("precision");
  f_Precision->setDoubleValue( 1e-3f );

  for (unsigned int iFloat=0; iFloat < NFIELDS; ++iFloat ){
    std::stringstream ss;
    ss << iFloat;
    std::string currentName = "float" + ss.str();
    m_FloatsFields.push_back(fieldC->addDouble(currentName.c_str()) );
    m_FloatsFields[iFloat]->setDoubleValue( 0.0f );
  }

  for (unsigned int iVector =0; iVector < NFIELDS; ++iVector ){
    std::stringstream ss;
    ss << iVector;
    std::string currentName = "vector" + ss.str();
    m_Vec6Fields.push_back( fieldC->addVec6f(currentName.c_str()) );
    m_Vec6Fields[iVector]->setVec6fValue( vec6() );
  }

  m_Updating = false;
  handleNotificationOn();
}
예제 #8
0
CSODistance::CSODistance() : BaseOp(0, 0)
{
  ML_TRACE_IN("CSODistance::CSODistance(int numInImages, int numOutImages) : BaseOp(numInImages, numOutImages)");

  handleNotificationOff();

  _csoList0 = NULL;
  _csoList1 = NULL;
  _tableHeader = "Id1,Id2,min,max,mean,stdDev";

  FieldContainer* fieldC = getFieldContainer();
  ML_CHECK(fieldC);

  (_input0CSOFld = fieldC->addBase("inCSOList"))->setBaseValue(NULL);
  (_input1CSOFld = fieldC->addBase("inCSOList1"))->setBaseValue(NULL);

  //////////////////////////////////////////////////////////////////////////

  char* distanceModes[LASTMODE];
  distanceModes[ FIRST2 ] = "First 2 CSOs";
  distanceModes[ INPLANE ] = "Match in plane";
  distanceModes[ INDEX ] = "Match index";
  _modeFld = fieldC->addEnum("mode",distanceModes,LASTMODE);
  _modeFld->setEnumValue( FIRST2 );

  //////////////////////////////////////////////////////////////////////////

  (_minimumDistanceFld = fieldC->addFloat("minimumDistance"))->setFloatValue(0);
  (_minimumDistancePoint1Fld = fieldC->addVec3f("minimumDistancePoint1"))->setVec3fValue(vec3(0.0,0.0,0.0));
  (_minimumDistancePoint2Fld = fieldC->addVec3f("minimumDistancePoint2"))->setVec3fValue(vec3(0.0,0.0,0.0));
  _distancesFld = addString("distances",_tableHeader );

  _AverageMinimumDistanceFld = addDouble("averageMinimumDistance", 0.0 );
  _AverageMeanDistanceFld    = addDouble("averageMeanDistance", 0.0 );
  _AverageMaxDistanceFld     = addDouble("averageMaximumDistance", 0.0 );

  //////////////////////////////////////////////////////////////////////////

  _tolleranceFld = addDouble("tollerance", 0.0001 );

  //////////////////////////////////////////////////////////////////////////

  _applyFld = fieldC->addNotify("apply");
  (_autoApplyFld = fieldC->addBool("autoApply"))->setBoolValue(true);
  _statusFld = fieldC->addString("status");
  _statusFld->setStringValue("Ready");

  //////////////////////////////////////////////////////////////////////////

  (_listenToRepaintNotificationsFld          = fieldC->addBool("listenToRepaintNotifications"))
    ->setBoolValue(false);
  (_listenToFinishingNotificationsFld        = fieldC->addBool("listenToFinishingNotifications"))
    ->setBoolValue(true);
  (_listenToSelectionChangedNotificationsFld = fieldC->addBool("listenToSelectionChangedNotifications"))
    ->setBoolValue(false);

  char* statisticsNames[LASTSTATISTIC];
  statisticsNames[ MIN ] = "Minimum";
  statisticsNames[ MAX ] = "Maximum";
  statisticsNames[ MEAN ] = "Mean";
  statisticsNames[ STDEV ] = "StDev";
  _curveStatistic = addEnum("curveStatistic",statisticsNames,LASTSTATISTIC );

  _isInNotificationCB = false; 	
  
  ML_CHECK_NEW(_outputXMarkerList,XMarkerList());

	(_outputXMarkerListFld = getFieldContainer()->addBase("outputXMarkerList"))->setBaseValue(NULL);

  _outputCurveList = new CurveList;
  (_outputCurveListFld = getFieldContainer()->addBase("outputCurveList"))->setBaseValue( _outputCurveList );

  handleNotificationOn();
}