'Displays a sweepster visualization using the incoming parameters. If id is available,
get the visualization with the given id; otherwise, create a new visualization using
a given dataset and regions.'

@web.expose
def sweepster(self, trans, id=None, hda_ldda=None, dataset_id=None, regions=None):

    regions = (regions or '{}')
    trans.get_history(most_recent=True, create=True)
    if id:
        viz = self.get_visualization(trans, id)
        viz_config = self.get_visualization_config(trans, viz)
        decoded_id = self.decode_id(viz_config['dataset_id'])
        dataset = self.hda_manager.get_owned(decoded_id, trans.user, current_history=trans.history)
    else:
        dataset = self.get_hda_or_ldda(trans, hda_ldda, dataset_id)
        job = self.hda_manager.creating_job(dataset)
        viz_config = {'dataset_id': dataset_id, 'tool_id': job.tool_id, 'regions': loads(regions)}
    tool = trans.app.toolbox.get_tool(viz_config['tool_id'])
    viz_config['tool'] = tool.to_dict(trans, io_details=True)
    viz_config['dataset'] = trans.security.encode_dict_ids(dataset.to_dict())
    return trans.fill_template_mako('visualization/sweepster.mako', config=viz_config)
