std::vector<std::pair<wxString, bool> > SettingsAudioOutput::GetRemainingAudioGroups(const wxTreeItemId& channel)
{
	std::vector<std::pair<wxString, bool> > result;
	std::vector<wxString> groups = m_GroupCallback.GetGroups();
	for(unsigned i = 0; i < groups.size(); i++)
	{
		const wxString& name = groups[i];
		if (!GetGroupNode(channel, name, true).IsOk())
			result.push_back(std::pair<wxString, bool>(name, true));
		if (!GetGroupNode(channel, name, false).IsOk())
			result.push_back(std::pair<wxString, bool>(name, false));
	}
	return result;
}
  bool CalculateSegmentationVolume::ReadyToRun()
  {
    Image::Pointer image;
    GetPointerParameter("Input", image);

    return image.IsNotNull() && GetGroupNode();
  }
  bool CalculateSegmentationVolume::ThreadedUpdateFunction()
  {
    // get image
    Image::Pointer image;
    GetPointerParameter("Input", image);

    AccessFixedDimensionByItk(image.GetPointer(),
                              ItkImageProcessing,
                              3); // some magic to call the correctly templated function (we only do 3D images here!)

    // consider single voxel volume
    Vector3D spacing = image->GetSlicedGeometry()->GetSpacing();                           // spacing in mm
    float volumeML = (ScalarType)m_Volume * spacing[0] * spacing[1] * spacing[2] / 1000.0; // convert to ml

    DataNode *groupNode = GetGroupNode();
    if (groupNode)
    {
      groupNode->SetProperty("volume", FloatProperty::New(volumeML));
      groupNode->SetProperty("centerOfMass", Vector3DProperty::New(m_CenterOfMass));
      groupNode->SetProperty("boundingBoxMinimum", Vector3DProperty::New(m_MinIndexOfBoundingBox));
      groupNode->SetProperty("boundingBoxMaximum", Vector3DProperty::New(m_MaxIndexOfBoundingBox));
      groupNode->SetProperty("showVolume", BoolProperty::New(true));
    }

    return true;
  }
Esempio n. 4
0
void XmlConfig::SetPath(const wxString& path)
{

    wxArrayString aParts;

    if (!path.empty() )
    {
        if ( path[0] == wxCONFIG_PATH_SEPARATOR )
        {
            // Absolute path
            wxSplitPath(aParts, path);
        }
        else
        {
            // Relative path, combine with current one
            wxString strFullPath = m_path;
            strFullPath << wxCONFIG_PATH_SEPARATOR << path;
            wxSplitPath(aParts, strFullPath);
        }
    }

    // recombine path parts in one variable
    m_path.Empty();
    for (unsigned int n = 0; n < aParts.Count(); n++ ) {
        m_path << wxCONFIG_PATH_SEPARATOR << aParts[n];
    }

    m_pathNode = GetGroupNode(aParts);

}
wxTreeItemId SettingsAudioOutput::AddGroupNode(const wxTreeItemId& channel, const wxString& name, bool left)
{
	wxTreeItemId current;
	current = GetGroupNode(channel, name, left);
	if (current.IsOk())
		return current;
	current = m_AudioOutput->AppendItem(channel, name, -1, -1, new AudioItemData(name, left, -121));
	m_AudioOutput->Expand(current);
	m_AudioOutput->Expand(channel);
	UpdateVolume(current, -121);
	return current;
}
Esempio n. 6
0
  /// to be called by subclasses when they want to insert some resulting object (binary image, surface, ...) into the
  /// data tree
  void SegmentationSink::InsertBelowGroupNode(mitk::DataNode *node)
  {
    DataNode *groupNode = GetGroupNode();

    if (m_DataStorage.IsNotNull())
    {
      if (node)
        node->GetData()->DisconnectPipeline();
      m_DataStorage->Add(node, groupNode);
    }

    RenderingManager::GetInstance()->RequestUpdateAll();
  }
  bool ShowSegmentationAsSurface::ReadyToRun()
  {
    try
    {
      Image::Pointer image;
      GetPointerParameter("Input", image);

      return image.IsNotNull() && GetGroupNode();
    }
    catch (std::invalid_argument &)
    {
      return false;
    }
  }
Esempio n. 8
0
//==========================================================================
// Class:			XMLConversionFactors
// Function:		ChangeEquivalence
//
// Description:		Changes an existing equivalence.
//
// Input Arguments:
//		name	= const wxString& specifying the group
//		e		= const Equivalence&
//
// Output Arguments:
//		None
//
// Return Value:
//		None
//
//==========================================================================
void XMLConversionFactors::ChangeEquivalence(const wxString &name, const Equivalence &e)
{
	wxXmlNode *groupNode = GetGroupNode(name);
	wxXmlNode *equiv = groupNode->GetChildren();

	wxString aName, bName;
	while (equiv)
	{
		if (equiv->GetAttribute(aUnitAttr, &aName) &&
			equiv->GetAttribute(bUnitAttr, &bName) &&
			aName.Cmp(e.aUnit) == 0 &&
			bName.Cmp(e.bUnit) == 0)
		{
			equiv->DeleteAttribute(equationAttr);
			equiv->AddAttribute(equationAttr, e.equation);
			return;
		}

		equiv = equiv->GetNext();
	}

	assert(false);// Didn't find a match!
}
  void ShowSegmentationAsSurface::ThreadedUpdateSuccessful()
  {
    m_Node = DataNode::New();

    bool wireframe(false);
    GetParameter("Wireframe", wireframe);
    if (wireframe)
    {
      VtkRepresentationProperty *np =
        dynamic_cast<VtkRepresentationProperty *>(m_Node->GetProperty("material.representation"));
      if (np)
        np->SetRepresentationToWireframe();
    }

    m_Node->SetProperty("opacity", FloatProperty::New(0.3));
    m_Node->SetProperty("line width", IntProperty::New(1));
    m_Node->SetProperty("scalar visibility", BoolProperty::New(false));

    std::string groupNodesName("surface");

    DataNode *groupNode = GetGroupNode();
    if (groupNode)
    {
      groupNode->GetName(groupNodesName);
      // if parameter smooth is set add extension to node name
      bool smooth(true);
      GetParameter("Smooth", smooth);
      if (smooth)
        groupNodesName.append("_smoothed");
    }
    m_Node->SetProperty("name", StringProperty::New(groupNodesName));

    // synchronize this object's color with the parent's color
    // surfaceNode->SetProperty( "color", parentNode->GetProperty( "color" ) );
    // surfaceNode->SetProperty( "visible", parentNode->GetProperty( "visible" ) );

    m_Node->SetData(m_Surface);

    BaseProperty *colorProp = groupNode->GetProperty("color");
    if (colorProp)
      m_Node->ReplaceProperty("color", colorProp->Clone());
    else
      m_Node->SetProperty("color", ColorProperty::New(1.0, 1.0, 0.0));

    bool showResult(true);
    GetParameter("Show result", showResult);

    bool syncVisibility(false);
    GetParameter("Sync visibility", syncVisibility);

    Image::Pointer image;
    GetPointerParameter("Input", image);

    BaseProperty *organTypeProp = image->GetProperty("organ type");
    if (organTypeProp)
      m_Surface->SetProperty("organ type", organTypeProp);

    BaseProperty *visibleProp = groupNode->GetProperty("visible");
    if (visibleProp && syncVisibility)
      m_Node->ReplaceProperty("visible", visibleProp->Clone());
    else
      m_Node->SetProperty("visible", BoolProperty::New(showResult));

    InsertBelowGroupNode(m_Node);

    Superclass::ThreadedUpdateSuccessful();
  }
Esempio n. 10
0
//==========================================================================
// Class:			XMLConversionFactors
// Function:		SetGroupVisibility
//
// Description:		Sets the visibility attribute for the specified group.
//
// Input Arguments:
//		name	= const wxString&
//		visible	= const bool&
//
// Output Arguments:
//		None
//
// Return Value:
//		None
//
//==========================================================================
void XMLConversionFactors::SetGroupVisibility(const wxString &name, const bool &visible)
{
	wxXmlNode *groupNode = GetGroupNode(name);
	groupNode->DeleteAttribute(displayAttr);
	groupNode->AddAttribute(displayAttr, visible ? _T("1") : _T("0"));
}
Esempio n. 11
0
//==========================================================================
// Class:			XMLConversionFactors
// Function:		AddEquivalence
//
// Description:		Adds an equivalence to the specified group.
//
// Input Arguments:
//		name	= const wxString& specifying the group
//		e		= const Equivalence&
//
// Output Arguments:
//		None
//
// Return Value:
//		None
//
//==========================================================================
void XMLConversionFactors::AddEquivalence(const wxString &name, const Equivalence &e)
{
	wxXmlNode *groupNode = GetGroupNode(name);
	AddNodePreserveFormatting(groupNode, e.ToXmlNode());
}