Commit e2a9386b authored by fw4splbot's avatar fw4splbot
Browse files

merge(dev): release 13.1.0

parents 2a42ae2d 496f5df8
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
<param name="landmarks" /> <param name="landmarks" />
<param name="patient_name" default="" /> <param name="patient_name" default="" />
<param name="orientation" default="axial" /> <!-- axial, frontal, sagittal --> <param name="orientation" default="axial" /> <!-- axial, frontal, sagittal -->
<param name="ModelRepresentationChannel" />
<param name="ModelDisplayChannel" />
<param name="CrossTypeChannel" default="crossTypeChannel" /> <param name="CrossTypeChannel" default="crossTypeChannel" />
<param name="PickingChannel" default="pickingChannel" /> <param name="PickingChannel" default="pickingChannel" />
<param name="setSagittalCameraChannel" /> <param name="setSagittalCameraChannel" />
...@@ -176,14 +174,6 @@ ...@@ -176,14 +174,6 @@
<slot>multiDistances/createDistance</slot> <slot>multiDistances/createDistance</slot>
</connect> </connect>
<connect channel="${ModelRepresentationChannel}">
<slot>modelSeries/updateNormalMode</slot>
</connect>
<connect channel="${ModelDisplayChannel}">
<slot>modelSeries/showReconstructions</slot>
</connect>
<connect channel="${PickingChannel}"> <connect channel="${PickingChannel}">
<signal>pickerInteractor/picked</signal> <signal>pickerInteractor/picked</signal>
</connect> </connect>
......
...@@ -129,8 +129,6 @@ ...@@ -129,8 +129,6 @@
<appConfig id="OrganManagerWithSeries" /> <appConfig id="OrganManagerWithSeries" />
<inout key="ORGAN_MANAGER_MODELSERIES" uid="${modelSeries}" /> <inout key="ORGAN_MANAGER_MODELSERIES" uid="${modelSeries}" />
<parameter replace="ICON_PATH" by="${ICON_PATH}" /> <parameter replace="ICON_PATH" by="${ICON_PATH}" />
<parameter replace="ModelRepresentationChannel" by="ModelRepresentationChannel" />
<parameter replace="ModelDisplayChannel" by="ModelDisplayChannel" />
</service> </service>
<service uid="cfgNegato1" type="::fwServices::SConfigController"> <service uid="cfgNegato1" type="::fwServices::SConfigController">
...@@ -141,8 +139,6 @@ ...@@ -141,8 +139,6 @@
<parameter replace="orientation" by="axial" /> <parameter replace="orientation" by="axial" />
<parameter replace="WID_PARENT" by="view_negato1" /> <parameter replace="WID_PARENT" by="view_negato1" />
<parameter replace="patient_name" by="${patient_name}" /> <parameter replace="patient_name" by="${patient_name}" />
<parameter replace="ModelRepresentationChannel" by="ModelRepresentationChannel" />
<parameter replace="ModelDisplayChannel" by="ModelDisplayChannel" />
<parameter replace="PickingChannel" by="pickerChannel" /> <parameter replace="PickingChannel" by="pickerChannel" />
<parameter replace="CrossTypeChannel" by="crossTypeChannel" /> <parameter replace="CrossTypeChannel" by="crossTypeChannel" />
<parameter replace="setSagittalCameraChannel" by="setSagittalCameraChannel" /> <parameter replace="setSagittalCameraChannel" by="setSagittalCameraChannel" />
...@@ -292,10 +288,6 @@ ...@@ -292,10 +288,6 @@
<signal>action_AxialViewMPR3D/triggered</signal> <signal>action_AxialViewMPR3D/triggered</signal>
</connect> </connect>
<!-- Shared channels between 3DNegatoWithAcq and OrganManagerWithSeries -->
<connect channel="ModelDisplayChannel" />
<connect channel="ModelRepresentationChannel" />
<!-- START AND STOP SERVICES --> <!-- START AND STOP SERVICES -->
<start uid="mainView" /> <start uid="mainView" />
<start uid="extractImage" /> <start uid="extractImage" />
......
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
<param name="ORGAN_MANAGER_MODELSERIES" /> <param name="ORGAN_MANAGER_MODELSERIES" />
<param name="CLOSE_CONFIG_CHANNEL" default="DummyChannel" /><!-- defined by SConfigLauncher --> <param name="CLOSE_CONFIG_CHANNEL" default="DummyChannel" /><!-- defined by SConfigLauncher -->
<param name="ICON_PATH" /> <param name="ICON_PATH" />
<param name="ModelRepresentationChannel" /> <param name="WindowTitle" default="Organs Manager"/>
<param name="ModelDisplayChannel" />
</parameters> </parameters>
<config> <config>
...@@ -17,7 +16,7 @@ ...@@ -17,7 +16,7 @@
<window onclose="notify" /> <window onclose="notify" />
<gui> <gui>
<frame> <frame>
<name>Organs Manager</name> <name>${WindowTitle}</name>
<icon>${ICON_PATH}</icon> <icon>${ICON_PATH}</icon>
<style mode="STAY_ON_TOP" /> <style mode="STAY_ON_TOP" />
</frame> </frame>
...@@ -72,15 +71,6 @@ ...@@ -72,15 +71,6 @@
<signal>organManagerFrame/closed</signal> <signal>organManagerFrame/closed</signal>
</connect> </connect>
<connect channel="${ModelDisplayChannel}">
<signal>listOrganEditor/recDisplayModified</signal>
<slot>listOrganEditor/showReconstructions</slot>
</connect>
<connect channel="${ModelRepresentationChannel}">
<signal>representationEditor/normalsModeModified</signal>
</connect>
<!-- START AND STOP SERVICES --> <!-- START AND STOP SERVICES -->
<start uid="organManagerFrame" /> <start uid="organManagerFrame" />
<start uid="myUpdaterReconst" /> <start uid="myUpdaterReconst" />
......
...@@ -108,8 +108,6 @@ ...@@ -108,8 +108,6 @@
<appConfig id="OrganManagerWithSeries" /> <appConfig id="OrganManagerWithSeries" />
<inout key="ORGAN_MANAGER_MODELSERIES" uid="optionalModelSeries" /> <inout key="ORGAN_MANAGER_MODELSERIES" uid="optionalModelSeries" />
<parameter replace="ICON_PATH" by="${ICON_PATH}" /> <parameter replace="ICON_PATH" by="${ICON_PATH}" />
<parameter replace="ModelRepresentationChannel" by="ModelRepresentationChannel" />
<parameter replace="ModelDisplayChannel" by="ModelDisplayChannel" />
</service> </service>
<service uid="ActionSnapshotVR" type="::uiVisu::action::SSnapshot" /> <service uid="ActionSnapshotVR" type="::uiVisu::action::SSnapshot" />
...@@ -230,14 +228,6 @@ ...@@ -230,14 +228,6 @@
<slot>snapshot1/snap</slot> <slot>snapshot1/snap</slot>
</connect> </connect>
<connect channel="ModelRepresentationChannel">
<slot>modelSeriesAdaptor/updateNormalMode</slot>
</connect>
<connect channel="ModelDisplayChannel">
<slot>modelSeriesAdaptor/showReconstructions</slot>
</connect>
<!-- START AND STOP SERVICES --> <!-- START AND STOP SERVICES -->
<start uid="computeHistogram" /> <start uid="computeHistogram" />
<start uid="LockImageSrv" /> <start uid="LockImageSrv" />
......
/* ***** BEGIN LICENSE BLOCK ***** /* ***** 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 * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */ * ****** END LICENSE BLOCK ****** */
...@@ -18,12 +18,12 @@ namespace basicRegistration ...@@ -18,12 +18,12 @@ namespace basicRegistration
/** /**
* @brief Register a point list against a reference point list. Each point in the list to register is matched * @brief Register a point list against a reference point list. Each point in the list to register is matched
* with a point in the reference list according to its label. * with a point in the reference list according to their order or to their labels if they have any.
* The output is a transformation matrix. * The output is a transformation matrix.
* @section Signals Signals * @section Signals Signals
* - \b errorComputed(double): emitted when registration error is computed. * - \b errorComputed(double): emitted when registration error is computed.
* @section Slots Slots * @section Slots Slots
* - \b changeMode(std::string, std::string): called when registration mode is changed. * - \b changeMode(std::string): called when registration mode is changed.
* Three modes are available : RIGID, SIMILARITY or AFFINE * Three modes are available : RIGID, SIMILARITY or AFFINE
* @section XML XML Configuration * @section XML XML Configuration
* @code{.xml} * @code{.xml}
...@@ -31,6 +31,7 @@ namespace basicRegistration ...@@ -31,6 +31,7 @@ namespace basicRegistration
<inout key="registeredPL" uid="..." /> <inout key="registeredPL" uid="..." />
<inout key="referencePL" uid="..." /> <inout key="referencePL" uid="..." />
<inout key="output" uid="..." /> <inout key="output" uid="..." />
<config mode="similarity" />
</service> </service>
@endcode @endcode
* @subsection In-Out In-Out * @subsection In-Out In-Out
...@@ -38,6 +39,9 @@ namespace basicRegistration ...@@ -38,6 +39,9 @@ namespace basicRegistration
* - \b referencePL [::fwData::PointList]: List containing the reference points to match with the points to register. * - \b referencePL [::fwData::PointList]: List containing the reference points to match with the points to register.
* - \b output [::fwData::TransformationMatrix3D]: Transformation matrix between the source and target points. * - \b output [::fwData::TransformationMatrix3D]: Transformation matrix between the source and target points.
* *
* @subsection Configuration Configuration
* - \b mode (optional, values=rigid|similarity|affine, default=rigid): registration mode.
*
*/ */
class BASICREGISTRATION_CLASS_API SPointListRegistration : public ::fwServices::IController class BASICREGISTRATION_CLASS_API SPointListRegistration : public ::fwServices::IController
{ {
...@@ -93,7 +97,7 @@ protected: ...@@ -93,7 +97,7 @@ protected:
private: private:
///SLOT: changeMode ///SLOT: changeMode
void changeMode(std::string _value, std::string _key); void changeMode(std::string _value);
/// Key source point list /// Key source point list
std::string m_registeredPointsKey; std::string m_registeredPointsKey;
......
/* ***** BEGIN LICENSE BLOCK ***** /* ***** 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 * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */ * ****** END LICENSE BLOCK ****** */
...@@ -51,6 +51,27 @@ SPointListRegistration::~SPointListRegistration() ...@@ -51,6 +51,27 @@ SPointListRegistration::~SPointListRegistration()
void SPointListRegistration::configuring() void SPointListRegistration::configuring()
{ {
const ConfigType config = this->getConfigTree().get_child("config.<xmlattr>");
const std::string mode = config.get< std::string >("mode", "rigid");
if(mode == "rigid")
{
m_registrationMode = RIGID;
}
else if(mode == "similarity")
{
m_registrationMode = SIMILARITY;
}
else if(mode == "affine")
{
m_registrationMode = AFFINE;
}
else
{
SLM_ERROR("Unknown registration mode: '" + mode + "', it must be 'rigid', 'similarity' or 'affine'."
" Defaulting to 'rigid'.")
}
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
...@@ -81,38 +102,59 @@ void SPointListRegistration::updating() ...@@ -81,38 +102,59 @@ void SPointListRegistration::updating()
vtkSmartPointer<vtkPoints> sourcePts = vtkSmartPointer<vtkPoints>::New(); vtkSmartPointer<vtkPoints> sourcePts = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPoints> targetPts = vtkSmartPointer<vtkPoints>::New(); vtkSmartPointer<vtkPoints> targetPts = vtkSmartPointer<vtkPoints>::New();
// Match each point in both list according to the label const auto& firstPoint = referencePL->getCRefPoints()[0];
for( ::fwData::Point::sptr pointRef : referencePL->getPoints() )
{
const std::string& labelRef =
pointRef->getField< ::fwData::String >(::fwDataTools::fieldHelper::Image::m_labelId )->value();
for( ::fwData::Point::sptr pointReg : registeredPL->getPoints() ) // If the points have labels ...
if(firstPoint->getField< ::fwData::String >(::fwDataTools::fieldHelper::Image::m_labelId ) != nullptr)
{
// ... Then match them according to that label.
for( ::fwData::Point::sptr pointRef : referencePL->getPoints() )
{ {
const std::string& labelReg = const std::string& labelRef =
pointReg->getField< ::fwData::String >(::fwDataTools::fieldHelper::Image::m_labelId )->value(); pointRef->getField< ::fwData::String >(::fwDataTools::fieldHelper::Image::m_labelId )->value();
if(labelRef == labelReg) for( ::fwData::Point::sptr pointReg : registeredPL->getPoints() )
{ {
auto coord = pointRef->getRefCoord(); const std::string& labelReg =
sourcePts->InsertNextPoint(coord[0], coord[1], coord[2]); pointReg->getField< ::fwData::String >(::fwDataTools::fieldHelper::Image::m_labelId )->value();
OSLM_TRACE("referencePL : " << pointRef->getField< ::fwData::String >( if(labelRef == labelReg)
::fwDataTools::fieldHelper::Image::m_labelId )->value() ); {
OSLM_TRACE( auto coord = pointRef->getRefCoord();
"referencePL : " << pointRef->getCoord()[0] << " " << pointRef->getCoord()[1] << " " << sourcePts->InsertNextPoint(coord[0], coord[1], coord[2]);
pointRef->getCoord()[2] );
OSLM_TRACE("referencePL : " << pointRef->getField< ::fwData::String >(
coord = pointReg->getRefCoord(); ::fwDataTools::fieldHelper::Image::m_labelId )->value() );
targetPts->InsertNextPoint(coord[0], coord[1], coord[2]); OSLM_TRACE(
OSLM_TRACE("registeredPL : " << pointReg->getField< ::fwData::String >( "referencePL : " << pointRef->getCoord()[0] << " " << pointRef->getCoord()[1] << " " <<
::fwDataTools::fieldHelper::Image::m_labelId )->value() ); pointRef->getCoord()[2] );
OSLM_TRACE(
"registeredPL : " << pointReg->getCoord()[0] << " " << pointReg->getCoord()[1] << " " << coord = pointReg->getRefCoord();
pointReg->getCoord()[2] ); targetPts->InsertNextPoint(coord[0], coord[1], coord[2]);
OSLM_TRACE("registeredPL : " << pointReg->getField< ::fwData::String >(
::fwDataTools::fieldHelper::Image::m_labelId )->value() );
OSLM_TRACE(
"registeredPL : " << pointReg->getCoord()[0] << " " << pointReg->getCoord()[1] << " " <<
pointReg->getCoord()[2] );
}
} }
} }
} }
else
{
// ... Else match them according to their order.
for(const auto& refPoint : referencePL->getCRefPoints())
{
const auto& coords = refPoint->getRefCoord();
sourcePts->InsertNextPoint(coords[0], coords[1], coords[2]);
}
for(const auto& regPoint : registeredPL->getCRefPoints())
{
const auto& coords = regPoint->getRefCoord();
targetPts->InsertNextPoint(coords[0], coords[1], coords[2]);
}
}
landmarkTransform->SetSourceLandmarks(sourcePts); landmarkTransform->SetSourceLandmarks(sourcePts);
landmarkTransform->SetTargetLandmarks(targetPts); landmarkTransform->SetTargetLandmarks(targetPts);
...@@ -135,9 +177,9 @@ void SPointListRegistration::updating() ...@@ -135,9 +177,9 @@ void SPointListRegistration::updating()
// Get the resulting transformation matrix (this matrix takes the source points to the target points) // Get the resulting transformation matrix (this matrix takes the source points to the target points)
vtkSmartPointer<vtkMatrix4x4> m = landmarkTransform->GetMatrix(); vtkSmartPointer<vtkMatrix4x4> m = landmarkTransform->GetMatrix();
m->Invert(); m->Invert();
for(size_t l = 0; l < 4; ++l) for(std::uint8_t l = 0; l < 4; ++l)
{ {
for(size_t c = 0; c < 4; ++c) for(std::uint8_t c = 0; c < 4; ++c)
{ {
matrix->setCoefficient(l, c, m->GetElement(l, c)); matrix->setCoefficient(l, c, m->GetElement(l, c));
} }
...@@ -198,7 +240,7 @@ void SPointListRegistration::swapping() ...@@ -198,7 +240,7 @@ void SPointListRegistration::swapping()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void SPointListRegistration::changeMode(std::string _value, std::string _key) void SPointListRegistration::changeMode(std::string _value)
{ {
if(_value == "RIGID") if(_value == "RIGID")
{ {
......
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2015. * FW4SPL - Copyright (C) IRCAD, 2009-2017.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation. * published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */ * ****** END LICENSE BLOCK ****** */
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<activate id="Tuto01Basic" /> <activate id="Tuto01Basic" />
<activate id="Tuto02DataServiceBasic" /> <activate id="Tuto02DataServiceBasic" />
<start id="visuVTKQt" />
<start id="guiQt" /> <start id="guiQt" />
</profile> </profile>
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2017.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#ifndef __UIIO_ACTION_SFOLDERSELECTOR_HPP__
#define __UIIO_ACTION_SFOLDERSELECTOR_HPP__
#include "uiIO/config.hpp"
#include <fwGui/IActionSrv.hpp>
#include <boost/filesystem/path.hpp>
namespace uiIO
{
namespace action
{
/**
* @brief Raise a pop-up dialog to select a directory, then send it via a signal.
*
* @section Signals Signals
* - \b folderSelector(::boost::filesystem::path) : Emitted when the directory is chosen.
*
* @section XML XML Configuration
*
* @code{.xml}
<service type="::uiIO::action::SFolderSelector" >
<dialogTitle>Select a folder</dialogTitle>
</service>
@endcode
* @subsection Configuration Configuration:
* - \b dialogTitle (optional): title of the dialog.
*/
class UIIO_CLASS_API SFolderSelector : public ::fwGui::IActionSrv
{
public:
fwCoreServiceClassDefinitionsMacro( (SFolderSelector)( ::fwGui::IActionSrv) )
/**
* @name Signals API
* @{
*/
typedef ::fwCom::Signal< void ( ::boost::filesystem::path ) > FolderSelectedSignalType;
static const ::fwCom::Signals::SignalKeyType s_FOLDER_SELECTED_SIG;
/// @}
UIIO_API SFolderSelector() noexcept;
UIIO_API virtual ~SFolderSelector() noexcept;
protected:
/// Do nothing
UIIO_API void configuring() override;
/// Do nothing.
UIIO_API void starting() override;
/// Show the dialog and send the signal with the chosen directory
UIIO_API void updating() override;
/// Do nothing.
UIIO_API void stopping() override;
private:
/// Optional title for the dialog
std::string m_dialogTitle;
};
} // namespace action
} // namespace uiIO
#endif // __UIIO_ACTION_SFOLDERSELECTOR_HPP__
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2017.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
#include "uiIO/action/SFolderSelector.hpp"
#include <fwCom/Signal.hxx>
#include <fwData/location/Folder.hpp>
#include <fwGui/dialog/LocationDialog.hpp>
#include <fwServices/macros.hpp>
namespace uiIO
{
namespace action
{
fwServicesRegisterMacro( ::fwGui::IActionSrv, ::uiIO::action::SFolderSelector, ::fwData::Object );
const ::fwCom::Signals::SignalKeyType SFolderSelector::s_FOLDER_SELECTED_SIG = "folderSelected";
//------------------------------------------------------------------------------
SFolderSelector::SFolderSelector( ) noexcept
{
newSignal< FolderSelectedSignalType >( s_FOLDER_SELECTED_SIG );
}
//------------------------------------------------------------------------------
SFolderSelector::~SFolderSelector() noexcept
{
}
//------------------------------------------------------------------------------
void SFolderSelector::configuring()
{
const auto& config = this->getConfigTree();
m_dialogTitle = config.get("dialogTitle", "Select a folder");
}
//------------------------------------------------------------------------------
void SFolderSelector::starting()
{
}
//------------------------------------------------------------------------------
void SFolderSelector::updating( )
{
static ::boost::filesystem::path _sDefaultPath("");
::fwGui::dialog::LocationDialog dialogFile;
dialogFile.setTitle(m_dialogTitle);
dialogFile.setDefaultLocation( ::fwData::location::Folder::New(_sDefaultPath) );
dialogFile.setOption(::fwGui::dialog::ILocationDialog::READ);
dialogFile.setType(::fwGui::dialog::ILocationDialog::FOLDER);
::fwData::location::Folder::sptr result;
result = ::fwData::location::Folder::dynamicCast( dialogFile.show() );
if (result)
{
auto sig = this->signal<FolderSelectedSignalType>(s_FOLDER_SELECTED_SIG);
sig->asyncEmit(result->getFolder());
}
}
//------------------------------------------------------------------------------
void SFolderSelector::stopping()
{