Verified Commit e0451915 authored by Flavien BRIDAULT-LOUCHEZ's avatar Flavien BRIDAULT-LOUCHEZ
Browse files

merge: dev into 643-core-reorganize-libs-and-modules

parents 03700c44 84ceb533
......@@ -268,8 +268,8 @@
</service>
<service uid="landmarksAdp" type="::sight::modules::viz::ogre::adaptor::SLandmarks" autoConnect="yes" >
<in key="landmarks" uid="${landmarks}" />
<config layer="defaultLayer" />
<inout key="landmarks" uid="${landmarks}" />
<config layer="defaultLayer" priority="4" />
</service>
<service uid="multiDistancesAdp" type="::sight::modules::viz::ogre::adaptor::SImageMultiDistances" autoConnect="yes" >
......@@ -342,9 +342,9 @@
</service>
<service uid="axialLandmarksAdp" type="::sight::modules::viz::ogre::adaptor::SLandmarks" autoConnect="yes" >
<in key="landmarks" uid="${landmarks}" />
<inout key="landmarks" uid="${landmarks}" />
<in key="image" uid="${image}" />
<config layer="axialNegatoLayer" label="false" orientation="axial" />
<config layer="axialNegatoLayer" label="false" orientation="axial" priority="4" />
</service>
<!-- Sagittal -->
......@@ -389,9 +389,9 @@
</service>
<service uid="sagittalLandmarksAdp" type="::sight::modules::viz::ogre::adaptor::SLandmarks" autoConnect="yes" >
<in key="landmarks" uid="${landmarks}" />
<inout key="landmarks" uid="${landmarks}" />
<in key="image" uid="${image}" />
<config layer="sagittalNegatoLayer" label="false" orientation="sagittal" />
<config layer="sagittalNegatoLayer" label="false" orientation="sagittal" priority="4" />
</service>
<!-- Frontal -->
......@@ -436,9 +436,9 @@
</service>
<service uid="frontalLandmarksAdp" type="::sight::modules::viz::ogre::adaptor::SLandmarks" autoConnect="yes" >
<in key="landmarks" uid="${landmarks}" />
<inout key="landmarks" uid="${landmarks}" />
<in key="image" uid="${image}" />
<config layer="frontalNegatoLayer" label="false" orientation="frontal" />
<config layer="frontalNegatoLayer" label="false" orientation="frontal" priority="4" />
</service>
<!-- ************************************* Services ************************************ -->
......
......@@ -516,7 +516,7 @@
</service>
<!-- Parameters for landmarks -->
<service uid="landmarksParameterSrv" type="::sight::modules::ui::qt::metrics::editor::SLandmarks" >
<service uid="landmarksParameterSrv" type="::sight::modules::ui::qt::metrics::editor::SLandmarks" autoConnect="yes" >
<inout key="landmarks" uid="landmarks" />
<advanced>yes</advanced>
</service>
......
File mode changed from 100755 to 100644
File mode changed from 100644 to 100755
......@@ -20,7 +20,7 @@
*
***********************************************************************/
#include "pchServicesOmp/pch.hpp"
#include "pch.hpp"
// Empty source file
// This is only to get a source file compiled, otherwise CMake would consider this target as an utility target
......
/************************************************************************
*
* Copyright (C) 2018-2021 IRCAD France
* Copyright (C) 2018-2021 IHU Strasbourg
*
* This file is part of Sight.
*
* Sight is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Sight. If not, see <https://www.gnu.org/licenses/>.
*
***********************************************************************/
#include "IGenerator.hpp"
namespace sight::services
{
//-----------------------------------------------------------------------------
IGenerator::IGenerator()
{
}
//-----------------------------------------------------------------------------
IGenerator::~IGenerator()
{
}
//-----------------------------------------------------------------------------
} // namespace sight::services.
/************************************************************************
*
* Copyright (C) 2018-2021 IRCAD France
* Copyright (C) 2018-2021 IHU Strasbourg
*
* This file is part of Sight.
*
* Sight is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Sight. If not, see <https://www.gnu.org/licenses/>.
*
***********************************************************************/
#pragma once
#include "services/config.hpp"
#include <services/IService.hpp>
namespace sight::services
{
/**
* @brief This interface defines generator service API.
* Must be implemented for services that generate data.
*/
class SERVICES_CLASS_API IGenerator : public services::IService
{
public:
fwCoreServiceMacro(IGenerator, services::IService)
protected:
/// Does nothing.
SERVICES_API IGenerator();
/// Destroys the interface.
SERVICES_API ~IGenerator() override;
};
} // namespace sight::services
fwLoadProperties()
find_package(ITK QUIET COMPONENTS ITKLabelMap ITKOptimizersv4 ITKTransform REQUIRED)
target_link_libraries(${FWPROJECT_NAME} PUBLIC ITKLabelMap ITKOptimizersv4 ITKTransform)
find_package(OpenMP QUIET)
if (OPENMP_FOUND)
target_link_libraries(${FWPROJECT_NAME} PRIVATE OpenMP::OpenMP_CXX)
......@@ -9,3 +12,4 @@ find_package(glm QUIET REQUIRED)
fwInclude(
${GLM_INCLUDE_DIRS}
)
/************************************************************************
*
* Copyright (C) 2018-2021 IRCAD France
* Copyright (C) 2018-2021 IHU Strasbourg
*
* This file is part of Sight.
*
* Sight is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Sight. If not, see <https://www.gnu.org/licenses/>.
*
***********************************************************************/
#pragma once
#include "imageFilterOp//config.hpp"
#include <fwData/Image.hpp>
#include <fwDataTools/helper/MedicalImage.hpp>
namespace imageFilterOp
{
/**
* @brief Static class to compute Bresenham lines in 3D images.
*
*/
class IMAGEFILTEROP_CLASS_API BresenhamLine
{
public:
/// Voxel coordinate type.
typedef std::array< ::fwData::Image::IndexType, 3 > CoordinatesType;
/// Series of coordinates making up a line.
typedef std::vector< CoordinatesType > PathType;
/// Computes a Bresenham line in a 3D image slice.
IMAGEFILTEROP_API static PathType draw(const ::fwDataTools::helper::MedicalImage::Orientation orientation,
const CoordinatesType& startCoord, const CoordinatesType& endCoord);
};
}
\ No newline at end of file
/************************************************************************
*
* Copyright (C) 2018-2021 IRCAD France
* Copyright (C) 2018-2021 IHU Strasbourg
*
* This file is part of Sight.
*
* Sight is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Sight. If not, see <https://www.gnu.org/licenses/>.
*
***********************************************************************/
#pragma once
#include "imageFilterOp/config.hpp"
#include <fwData/Image.hpp>
#include <fwData/PointList.hpp>
#include <cstdint>
namespace imageFilterOp
{
/// Labels filter without template.
IMAGEFILTEROP_API ::fwData::Image::sptr labeling(::fwData::Image::sptr image, unsigned int _numLabels);
/// Labels filter with centroids.
IMAGEFILTEROP_API void computeCentroids(::fwData::Image::sptr image,
std::vector< ::fwData::PointList::sptr > pointListCentroids,
std::vector< std::vector<size_t> > pointListLabels);
} //namespace imageFilterOp.
/************************************************************************
*
* Copyright (C) 2018-2021 IRCAD France
* Copyright (C) 2018-2021 IHU Strasbourg
*
* This file is part of Sight.
*
* Sight is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Sight. If not, see <https://www.gnu.org/licenses/>.
*
***********************************************************************/
#pragma once
#include "imageFilterOp/BresenhamLine.hpp"
#include "imageFilterOp/config.hpp"
#include <fwData/Image.hpp>
#include <fwDataTools/helper/MedicalImage.hpp>
#include <fwDataTools/ImageDiff.hpp>
#include <array>
namespace imageFilterOp
{
/**
* @brief Draws lines with a given thickness in a 3D image slice.
*/
class IMAGEFILTEROP_CLASS_API LineDrawer
{
public:
typedef BresenhamLine::CoordinatesType CoordinatesType;
typedef ::fwDataTools::helper::MedicalImage::Orientation OrientationType;
/// Constructor, instantiates a drawer with an image and a region of interest.
IMAGEFILTEROP_API LineDrawer(const ::fwData::Image::sptr& img, const ::fwData::Image::csptr& roi);
/**
* @brief Draws a line in an image slice.
* @param[in] orientation slice orientation.
* @param[in] startCoord point where the line begins.
* @param[in] endCoord point where the line ends.
* @param[in] value value written in the image buffer.
* @param[in] thickness line thickness in millimeters.
* @param[in] overwrite overwrite mode, don't overwrite existing pixels if not set.
* @return The differences in the image before and after drawing.
*/
IMAGEFILTEROP_API ::fwDataTools::ImageDiff draw(const OrientationType orientation,
const CoordinatesType& startCoord,
const CoordinatesType& endCoord,
::fwData::Image::BufferType* value,
const double thickness,
const bool overwrite = true);
private:
/**
* @brief Draws a filled discrete ellipse in a 3D image slice.
*
* The minor and major axes are computed from the radius and the spacing.
*
* @param[in] c center of the ellipse.
* @param[in] value value written in the image buffer.
* @param[in] radius the radius of the ellipse in millimeters.
* @param[in] firstDim the main axis of the plane (slice) in which the ellipse is drawn.
* @param[in] secondDim the secondary axis of the plane (slice) in which the ellipse is drawn.
* @param[in] overwrite overwrite mode, don't overwrite existing pixels if not set.
* @param[in,out] diff vector storing the differences in the image before and after drawing.
* @return true if at least one pixel has been drawn, false otherwise.
*/
bool drawEllipse( const LineDrawer::CoordinatesType& c, ::fwData::Image::BufferType* value,
const double radius, const size_t firstDim, const size_t secondDim, const bool overwrite,
::fwDataTools::ImageDiff& diff);
/**
* @brief Draws a pixel in a 3D image if the right conditions are met.
*
* Drawing conditions:
* - Inside the ROI, if one is used
* - The pixel has a value different from the one being set
* - Don't overwrite a non empty pixel if not in overwrite mode
*
* @param[in] index index in the image buffer where the pixel will be written.
* @param[in] value value written in the image buffer.
* @param[in] overwrite overwrite mode, don't overwrite existing pixels if not set.
* @param[in,out] diff vector storing the differences in the image before and after drawing.
* @return true if at least one pixel has been drawn, false otherwise.
*/
bool drawPixel( const ::fwData::Image::IndexType index, ::fwData::Image::BufferType* value, const bool overwrite,
::fwDataTools::ImageDiff& diff);
/// Takes ROI into account.
bool m_useROI;
/// Image pixel size.
unsigned char m_imageTypeSize;
/// ROI pixel size.
unsigned char m_roiTypeSize;
/// Image length.
::fwData::Image::IndexType m_yPitch;
/// Image depth.
::fwData::Image::IndexType m_zPitch;
/// Image to draw in.
::fwData::Image::sptr m_image;
/// ROI to use.
::fwData::Image::csptr m_roiImage;
};
} // namespace imageFilterOp
/************************************************************************
*
* Copyright (C) 2018-2021 IRCAD France
* Copyright (C) 2018-2021 IHU Strasbourg
*
* This file is part of Sight.
*
* Sight is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Sight. If not, see <https://www.gnu.org/licenses/>.
*
***********************************************************************/
#pragma once
#include "imageFilterOp/config.hpp"
#include <fwData/TransformationMatrix3D.hpp>
#include <fwData/Vector.hpp>
#include <fwDataTools/TransformationMatrix3D.hpp>
#include <glm/mat4x4.hpp>
namespace imageFilterOp
{
/**
* @brief Computes an 'average' matrix from a matrix list.
*/
class IMAGEFILTEROP_CLASS_API MatrixRegressor
{
public:
typedef ::glm::dvec4 PointType;
/**
* @brief Constructor
* @pre The current implementation assumes that the matrices have a uniform scale.
*
* @param matrixList list of matrix to 'average'.
* @param points list of points used for solving.
*/
IMAGEFILTEROP_API MatrixRegressor(const ::fwData::Vector::csptr& matrixList, const std::vector<PointType>& points);
/**
* @brief computes the matrix that best fits our matrix list.
*
* @param initValue the initial value passed to the solver.
* @param stepLength the initial step distance in a line direction.
* @param stepTolerance terminates the optimization when the parameter is within this distance of the local minima.
* @param valueTolerance terminates the optimization when the transformed distance between the matrices and our
* current solution and the local extreme are likely to be within this tolerance.
* @param maxIter the maximum number of iterations for the solver.
* @return the 'average' matrix
*/
IMAGEFILTEROP_API ::fwData::TransformationMatrix3D::sptr minimize(
const ::fwData::TransformationMatrix3D::csptr& initValue,
double stepLength = 1.,
double stepTolerance = 1e-2,
double valueTolerance = 1e-2,
unsigned int maxIter = 10000);
private:
std::vector< ::glm::dmat4 > m_matList;
std::vector< PointType > m_pointList;
};
} // namespace imageFilterOp.
/************************************************************************
*
* Copyright (C) 2018-2021 IRCAD France
* Copyright (C) 2018-2021 IHU Strasbourg
*
* This file is part of Sight.
*
* Sight is free software: you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Sight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Sight. If not, see <https://www.gnu.org/licenses/>.
*
***********************************************************************/
#pragma once
#include "imageFilterOp/config.hpp"
#include <imageFilterOp//BresenhamLine.hpp>
#include <fwData/Image.hpp>
#include <fwDataTools/helper/Image.hpp>
#include <fwDataTools/helper/ImageGetter.hpp>
#include <fwDataTools/helper/MedicalImage.hpp>
#include <fwDataTools/ImageDiff.hpp>
namespace imageFilterOp
{
/**
* @brief Flood fills an image as long as the neighboring voxels are greater than the smallest seed value.
*/
class IMAGEFILTEROP_CLASS_API MinMaxPropagation
{
public:
enum Mode
{
MIN,
MAX,
MINMAX
};
typedef ::imageFilterOp::BresenhamLine::CoordinatesType CoordinatesType;
typedef ::fwDataTools::helper::MedicalImage::Orientation OrientationType;
typedef std::vector< CoordinatesType > SeedsType;
/**
* @brief Constructor.
* @param[in] inImage image in which we propagate.
* @param[in,out] outImage mask image containing the written values.
* @param[in] roi region of interest.
*/
IMAGEFILTEROP_API MinMaxPropagation(const ::fwData::Image::csptr& inImage, const ::fwData::Image::sptr& outImage,
const ::fwData::Image::csptr& roi);
/**
* @brief propagates through the image starting from each seed as along as the encountered voxel value
* is greater than smallest seed value.
* @param[in] seeds points where propagation is started.
* @param[in] value the value propagated through the buffer.
* @param[in] radius maximum propagation distance.
* @param[in] overwrite overwrite non zero voxels.
* @param[in] mode propagation mode (min, max, or minmax).
* @return the differences in the image before and after propagation.
*/
IMAGEFILTEROP_API ::fwDataTools::ImageDiff propagate(SeedsType& seeds, ::fwData::Image::BufferType* value,
const double radius, const bool overwrite, const Mode mode);
private:
/// Seed list.
SeedsType m_seeds;
/// Input image. Where the voxel values are read from.