bool SelectionVOI::populateXMLNode( wxXmlNode *pCurNode, const wxString &rootPath )
{
    bool result( SelectionObject::populateXMLNode( pCurNode, rootPath ) );
    
    if( result )
    {
        wxString floatPrecision = wxT( ".8" );
        
        wxXmlNode *pVoiNode = new wxXmlNode( NULL, wxXML_ELEMENT_NODE, wxT( "voi_properties" ) );
        pCurNode->AddChild( pVoiNode );
        
        pVoiNode->AddAttribute( new wxXmlAttribute( wxT( "gen_threshold" ), wxStrFormat( m_generationThreshold, floatPrecision ) ) );
        pVoiNode->AddAttribute( new wxXmlAttribute( wxT( "thres_op_type" ), Helper::getThresholdingTypeString( m_thresType ) ) );
        
        wxXmlNode *pVoiGenAnatPath = new wxXmlNode( NULL, wxXML_ELEMENT_NODE, wxT( "generation_anatomy" ) );
        pVoiNode->AddChild( pVoiGenAnatPath );
        
        // Get the dataset to be able to get the index.
        DatasetInfo *pDS = DatasetManager::getInstance()->getDataset( m_sourceAnatIndex );
        if( pDS )
        {
            wxFileName tempName( pDS->getPath() );
            tempName.MakeRelativeTo( rootPath );
            pVoiGenAnatPath->AddChild( new wxXmlNode( NULL, wxXML_TEXT_NODE, wxT( "path"), tempName.GetFullPath() ) );
        }
        else
        {
            // Should never happen.
            result = false;
        }
    }
    
    return result;
}