Commit 21f2efdc authored by fw4splbot's avatar fw4splbot
Browse files

merge(dev): release 16.0.0

parents 6ee4605b cfff1dce
......@@ -58,7 +58,7 @@ Example:
<axis id="xAxis" origin="0.0" scale="1.0" scaleType="LINEAR" />
<axis id="yAxis" origin="0.0" scale="-1.0" scaleType="LINEAR" />
<axis id="axeHistogramY" origin="0.0" scale="-0.000001" scaleType="LINEAR" />
<adaptor uid="shutterGrid" />
<adaptor uid="shutterAbscissa" />
<adaptor uid="shutterOrdinate" />
......@@ -66,7 +66,7 @@ Example:
<adaptor uid="viewportRangeSelector" />
</scene>
</service>
<service uid="shutterGrid" type="::scene2D::adaptor::SGrid2D" >
<config xMin="-1200" xMax="1400" yMin="-0.7" yMax="1.7" xSpacing="200" ySpacing="0.2" color="darkGray" xAxis="xAxis" yAxis="yAxis" zValue="1" />
</service>
......@@ -100,7 +100,7 @@ Example:
<axis id="xAxis" origin="0.0" scale="1.0" scaleType="LINEAR" />
<axis id="yAxis" origin="0.0" scale="-1.0" scaleType="LINEAR" />
<axis id="axeHistogramY" origin="0.0" scale="-0.000001" scaleType="LINEAR" />
<adaptor uid="grid" />
<adaptor uid="abscissa" />
<adaptor uid="ordinate" />
......@@ -114,10 +114,10 @@ Example:
<adaptor uid="axisLeft" />
<adaptor uid="scaleValuesBottom" />
<adaptor uid="axisBottom" />
</scene>
</service>
<service uid="grid" type="::scene2D::adaptor::SGrid2D" >
<config xMin="-1200" xMax="1500" yMin="0.0" yMax="1.0" xSpacing="100" ySpacing="0.1" opacity="0.25" color="darkGray" xAxis="xAxis" yAxis="yAxis" zValue="1" />
</service>
......@@ -190,14 +190,14 @@ Example:
<!-- Start/Stop services -->
<start uid="histogramView" />
<start uid="Scene2D" />
<!-- Scene2D Shutter -->
<start uid="shutterGrid" />
<start uid="shutterGrid" />
<start uid="shutterAbscissa" />
<start uid="shutterOrdinate" />
<start uid="shutterHistogram" />
<start uid="viewportRangeSelector" />
<!-- Scene2D -->
<start uid="grid" />
<start uid="abscissa" />
......
<plugin id="qtSceneConfig" version="@PROJECT_VERSION@" >
<requirement id="dataReg" />
<requirement id="servicesReg" />
<requirement id="scene2D" />
<xi:include href="configurations/TransferFunctionWidget.xml" xmlns:xi="http://www.w3.org/2003/XInclude" />
</plugin>
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2014-2017.
* FW4SPL - Copyright (C) IRCAD, 2014-2018.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#ifndef __PREFERENCES_SPREFERENCES_HPP__
#define __PREFERENCES_SPREFERENCES_HPP__
#pragma once
#include "preferences/config.hpp"
......@@ -15,13 +14,22 @@
namespace preferences
{
/**
* @brief Service to load and save preferences.
*
* @section XML XML Configuration
*
* @code{.xml}
<filename>path/to/my/preferences.json</filename>
* @endcode
* @throw ::fwTools::Failed
<service type="::preferences::SPreferences">
<inout key="preferences" uid="..." />
<filename>path/to/my/preferences.json</filename>
</service>
@endcode
* @subsection In-Out In-Out
* - \b preferences [::fwData::Object]: object containing the preferences to load/save.
* @subsection Configuration Configuration
* - \b filename : path to the preferences file
*/
class PREFERENCES_CLASS_API SPreferences : public ::fwPreferences::IPreferences
{
......@@ -63,5 +71,3 @@ private:
};
} // namespace preferences
#endif /*__PREFERENCES_SPREFERENCES_HPP__*/
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2014-2016.
* FW4SPL - Copyright (C) IRCAD, 2014-2018.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#include "preferences/Plugin.hpp"
#include "preferences/SPreferences.hpp"
#include <fwData/String.hpp>
#include <fwPreferences/helper.hpp>
......@@ -34,9 +36,8 @@ void Plugin::start()
m_preferences = ::fwData::Composite::New();
::fwServices::IService::sptr prefSrv;
prefSrv = ::fwServices::add (m_preferences,
"::fwPreferences::IPreferences", "::preferences::SPreferences",
s_PREF_SERVICE_UID);
prefSrv = ::fwServices::add("::preferences::SPreferences", s_PREF_SERVICE_UID);
prefSrv->registerInOut(m_preferences, fwPreferences::s_PREFERENCES_KEY);
try
{
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2014-2016.
* FW4SPL - Copyright (C) IRCAD, 2014-2018.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -9,13 +9,15 @@
#include <fwAtomConversion/convert.hpp>
#include <fwAtomsBoostIO/Reader.hpp>
#include <fwAtomsBoostIO/Writer.hpp>
#include <fwAtomsBoostIO/types.hpp>
#include <fwAtomsBoostIO/Writer.hpp>
#include <fwData/Composite.hpp>
#include <fwDataCamp/visitor/RecursiveLock.hpp>
#include <fwPreferences/helper.hpp>
#include <fwRuntime/ConfigurationElement.hpp>
#include <fwServices/macros.hpp>
......@@ -69,7 +71,14 @@ void SPreferences::load()
const ::boost::filesystem::path folderPath = m_prefFile.parent_path();
const ::boost::filesystem::path filename = m_prefFile.filename();
::fwData::Object::sptr data = this->getObject< ::fwData::Object >();
::fwData::Object::sptr data = this->getInOut< ::fwData::Object >(::fwPreferences::s_PREFERENCES_KEY);
if (!data)
{
FW_DEPRECATED_MSG("The 'preferences' object is not set correctly, you must define the object as: "
"<inout key=\"preferences\" uid=\"...\".");
data = this->getObject< ::fwData::Object >();
}
// Read atom
::fwZip::IReadArchive::sptr readArchive = ::fwZip::ReadDirArchive::New(folderPath.string());
......@@ -96,10 +105,17 @@ void SPreferences::save()
const ::boost::filesystem::path folderPath = m_prefFile.parent_path();
const ::boost::filesystem::path filename = m_prefFile.filename();
::fwData::Object::sptr obj = this->getObject();
::fwData::Object::sptr obj = this->getInOut< ::fwData::Object >(::fwPreferences::s_PREFERENCES_KEY);
if (!obj)
{
FW_DEPRECATED_MSG("The 'preferences' object is not set correctly, you must define the object as: "
"<inout key=\"preferences\" uid=\"...\".");
obj = this->getObject< ::fwData::Object >();
}
// Mutex data lock
::fwDataCamp::visitor::RecursiveLock recursiveLock (obj);
::fwDataCamp::visitor::RecursiveLock recursiveLock(obj);
// Convert data to atom
::fwAtoms::Object::sptr atom = ::fwAtomConversion::convert(obj);
......@@ -122,4 +138,3 @@ void SPreferences::save()
//-----------------------------------------------------------------------------
} //namespace preferences
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2017.
* FW4SPL - Copyright (C) IRCAD, 2009-2018.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -35,8 +35,6 @@ void Plugin::start()
::fwServices::registry::ServiceConfig::getDefault()->parseBundleInformation();
::fwServices::registry::AppConfig::getDefault()->parseBundleInformation();
::fwServices::registry::AppConfigParameters::getDefault()->parseBundleInformation();
::fwThread::createDefaultPool();
}
//-----------------------------------------------------------------------------
......@@ -49,8 +47,6 @@ void Plugin::initialize()
void Plugin::uninitialize()
{
::fwThread::deleteDefaultPool();
// Clear all service configs
::fwServices::registry::ServiceConfig::getDefault()->clearRegistry();
......
......@@ -42,6 +42,8 @@
#include <boost/assign.hpp>
#include <boost/filesystem/path.hpp>
#include <regex>
namespace ioAtoms
{
......@@ -184,16 +186,104 @@ bool SWriter::versionSelection()
else
{
versions.push_back(m_version);
std::transform(versions.begin(), versions.end(), versions.begin(), [](const std::string& _version)
{
static const std::regex ala("ALA");
return std::regex_replace(_version, ala, "");
} );
// Sort versions according to repository/number. This is not really honnest since we should not make any
// assumption about the versioning convention, especially for child repositories... But since this is
// how things are organized currently I don't think this is such a big issue
std::sort(versions.begin(), versions.end(), [](const std::string& _a, const std::string& _b)
{
try
{
// Assume a pattern like V[0-9][0-9][A-Z][A-Z][A-Z]
// Sort with the version number
const std::string repoA = _a.substr(3, _a.size());
const std::string repoB = _b.substr(3, _b.size());
if(repoA == repoB)
{
const std::string numA = _a.substr(1, 2);
const std::string numB = _b.substr(1, 2);
return numA > numB;
}
return repoA < repoB;
}
catch ( std::out_of_range e)
{
OSLM_ERROR("Bad version format: either " + _a + " or " + _b);
return false;
}
});
std::vector< std::string > prettyVersionsAll;
std::map< std::string, std::string > prettyVersionsToVersions;
for(const auto& v : versions)
{
try
{
const std::string num = v.substr(0, 3);
const std::string repo = v.substr(3, v.size());
const std::string prettyVersion = num + ((repo.empty()) ? "" : " (" + repo + ")");
prettyVersionsAll.push_back(prettyVersion);
prettyVersionsToVersions[ prettyVersion ] = v;
}
catch ( std::out_of_range e)
{
OSLM_ERROR("Bad version format: " + v);
prettyVersionsAll.push_back(v);
prettyVersionsToVersions[ v ] = v;
}
}
// Create a shortened list of versions, with only the latest ones of each repo
std::vector< std::string > prettyVersions;
prettyVersions.push_back(prettyVersionsAll[0]);
for(auto itVersion = prettyVersionsAll.begin() + 1; itVersion != prettyVersionsAll.end(); ++itVersion)
{
const auto& versionA = *(itVersion - 1);
const auto& versionB = *(itVersion);
const std::string repoA = versionA.substr(3, versionA.size());
const std::string repoB = versionB.substr(3, versionB.size());
if(repoA != repoB)
{
prettyVersions.push_back(versionB);
}
}
::fwGui::dialog::SelectorDialog dialogVersion;
dialogVersion.setTitle("Archive version");
dialogVersion.setMessage("Select an archive version");
dialogVersion.setSelections(versions);
bool selectAmongstAllVersions = false;
dialogVersion.addCustomButton("Advanced", [&selectAmongstAllVersions]()
{
selectAmongstAllVersions = true;
});
dialogVersion.setSelections(prettyVersions);
std::string result = dialogVersion.show();
if ( !result.empty() )
if(selectAmongstAllVersions)
{
::fwGui::dialog::SelectorDialog dialogVersionAll;
dialogVersionAll.setTitle("Archive version");
dialogVersionAll.setMessage("Select an archive version");
dialogVersionAll.setSelections(prettyVersionsAll);
result = dialogVersionAll.show();
}
if( !result.empty() )
{
m_exportedVersion = result;
m_exportedVersion = prettyVersionsToVersions[result];
}
return !result.empty();
}
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2018.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#pragma once
#include "ioDcmtk/config.hpp"
#include <fwIO/IReader.hpp>
#include <boost/filesystem/path.hpp>
#include <string>
namespace fwMedData
{
class SeriesDB;
class Patient;
}
namespace ioDcmtk
{
/**
* @brief Read DICOM Series from a DICOM with DCMTK
*/
class IODCMTK_CLASS_API SDicomSeriesDBReader : public ::fwIO::IReader
{
public:
fwCoreServiceClassDefinitionsMacro( (SDicomSeriesDBReader)( ::fwIO::IReader) );
/**
* @brief constructor
*
*/
IODCMTK_API SDicomSeriesDBReader() noexcept;
/**
* @brief destructor
*/
IODCMTK_API virtual ~SDicomSeriesDBReader() noexcept;
protected:
/// Override
IODCMTK_API virtual void starting() override;
/// Override
IODCMTK_API virtual void stopping() override;
/// Override
IODCMTK_API virtual void configuring() override;
/// Override
IODCMTK_API void updating() override;
/// Override
IODCMTK_API void info(std::ostream& _sstream ) override;
/// Override
IODCMTK_API virtual std::string getSelectorDialogTitle() override;
/// Override
IODCMTK_API virtual void configureWithIHM() override;
/// Return path type managed by the service, here FOLDER
IODCMTK_API ::fwIO::IOPathType getIOPathType() const override;
private:
void notificationOfDBUpdate();
SPTR(::fwMedData::SeriesDB) createSeriesDB(const ::boost::filesystem::path& dicomDir);
};
} // namespace ioDcmtk
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2018.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#pragma once
#include "ioDcmtk/config.hpp"
#include <fwIO/IReader.hpp>
#include <boost/filesystem/path.hpp>
#include <string>
namespace fwMedData
{
class SeriesDB;
class Patient;
}
namespace ioDcmtk
{
/**
* @brief SDicomTagSeriesDBReader reads a folder that has DICOM images.
*
* @section XML Configuration
* @code{.xml}
<service uid="..." type="::ioDcmtk::SDicomTagSeriesDBReader" >
<inout key="data" uid="..."/>
</service>
* @endcode
*
* @subsection In-Out In-Out
* - \b data [::fwMedData::SeriesDB]: SeriesDB
*/
class IODCMTK_CLASS_API SDicomTagSeriesDBReader : public ::fwIO::IReader
{
public:
typedef std::string ExtensionType;
typedef std::vector< ExtensionType > ExtensionsType;
fwCoreServiceClassDefinitionsMacro( (SDicomTagSeriesDBReader)( ::fwIO::IReader) );
/**
* @brief constructor
*
*/
IODCMTK_API SDicomTagSeriesDBReader() noexcept;
/**
* @brief destructor
*/
IODCMTK_API virtual ~SDicomTagSeriesDBReader() noexcept;
protected:
/// Override
IODCMTK_API virtual void starting() override;
/// Override
IODCMTK_API virtual void stopping() override;
/// Override
IODCMTK_API virtual void configuring() override;
/// Override
IODCMTK_API void updating() override;
/// Override
IODCMTK_API void info(std::ostream& _sstream ) override;
/// Override
IODCMTK_API virtual std::string getSelectorDialogTitle() override;
/// Override
IODCMTK_API virtual void configureWithIHM() override;
/// Return path type managed by the service, here FOLDER
IODCMTK_API ::fwIO::IOPathType getIOPathType() const override;
private:
void notificationOfDBUpdate();
SPTR(::fwMedData::SeriesDB) createSeriesDB(const ::boost::filesystem::path& dicomDir);
};
} // namespace ioDcmtk
......@@ -10,18 +10,4 @@
<desc>Series DB Reader (DCMTK)</desc>
</extension>
<extension implements="::fwServices::registry::ServiceFactory">
<type>::fwIO::IReader</type>
<service>::ioDcmtk::SDicomSeriesDBReader</service>
<object>::fwMedData::SeriesDB</object>
<desc>Dicom Series DB Reader (DCMTK)</desc>
</extension>
<extension implements="::fwServices::registry::ServiceFactory">
<type>::fwIO::IReader</type>
<service>::ioDcmtk::SDicomTagSeriesDBReader</service>
<object>::fwMedData::SeriesDB</object>
<desc>Dicom Tag Series DB Reader (DCMTK)</desc>
</extension>
</plugin>
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2018.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#include "ioDcmtk/SDicomSeriesDBReader.hpp"
#include <fwCom/Signal.hpp>
#include <fwCom/Signal.hxx>
#include <fwCom/Signals.hpp>
#include <fwDcmtkIO/SeriesDBReader.hpp>
#include <fwGui/Cursor.hpp>
#include <fwGui/dialog/LocationDialog.hpp>
#include <fwGui/dialog/MessageDialog.hpp>
#include <fwGui/dialog/ProgressDialog.hpp>
#include <fwIO/IReader.hpp>
#include <fwMedData/SeriesDB.hpp>
#include <fwServices/macros.hpp>
#include <fwTools/ProgressToLogger.hpp>
namespace ioDcmtk
{
fwServicesRegisterMacro( ::fwIO::IReader, ::ioDcmtk::SDicomSeriesDBReader, ::fwMedData::SeriesDB );
//------------------------------------------------------------------------------
SDicomSeriesDBReader::SDicomSeriesDBReader() noexcept
{
}
//------------------------------------------------------------------------------
SDicomSeriesDBReader::~SDicomSeriesDBReader() noexcept
{
}
//------------------------------------------------------------------------------
void SDicomSeriesDBReader::configuring()
{
::fwIO::IReader::configuring();
}
//------------------------------------------------------------------------------
void SDicomSeriesDBReader::configureWithIHM()
{
static ::boost::filesystem::path _sDefaultPath;
::fwGui::dialog::LocationDialog dialogFile;
dialogFile.setTitle(m_windowTitle.empty() ? this->getSelectorDialogTitle() : m_windowTitle);
dialogFile.setDefaultLocation( ::fwData::location::Folder::New(_sDefaultPath) );
dialogFile.setOption(::fwGui::dialog::ILocationDialog::READ);
dialogFile.setType(::fwGui::dialog::LocationDialog::FOLDER);
::fwData::location::Folder::