7 #include "fwDataTools/Image.hpp" 9 #include <fwTools/Combinatory.hpp> 10 #include <fwTools/Dispatcher.hpp> 11 #include <fwTools/DynamicTypeKeyTypeMapping.hpp> 12 #include <fwTools/IntrinsicTypes.hpp> 21 ::fwData::Image::sptr img;
22 ::fwData::Image::sptr roi;
27 template<
typename IMAGE_TYPE>
32 template<
typename ROI_TYPE>
35 typedef IMAGE_TYPE ImgType;
36 typedef ROI_TYPE RoiType;
38 SLM_ASSERT(
"Null image pointer", p.img && p.roi);
40 ::fwData::Array::sptr imgData;
41 ::fwData::Array::sptr roiData;
42 imgData = p.img->getDataArray();
43 roiData = p.roi->getDataArray();
47 SLM_ASSERT(
"Null data array pointer", imgData && roiData);
50 ImgType* imIt = imgHelper.
begin<ImgType>();
51 RoiType* roiIt = roiHelper.
begin<RoiType>();
53 const ImgType* imEnd = imIt + imgData->getNumberOfElements();
55 for (; imIt != imEnd; ++imIt, ++roiIt)
71 template<
typename IMAGE_TYPE>
82 SLM_ASSERT(
"Null image pointers", image && roi);
83 SLM_ASSERT(
"Images have different size", image->getSize() == roi->getSize());
85 using namespace boost;
99 ::fwData::Image::sptr img;
100 ::fwData::Image::sptr imgRoiApplyed;
101 ::fwData::Image::sptr roi;
107 template<
typename IMAGE_TYPE>
113 template<
typename ROI_TYPE>
116 bool& result = p.result;
119 typedef IMAGE_TYPE ImgType;
120 typedef ROI_TYPE RoiType;
122 ::fwData::Array::sptr imgData;
123 ::fwData::Array::sptr imgRoiApplyedData;
124 ::fwData::Array::sptr roiData;
126 imgData = p.img->getDataArray();
127 imgRoiApplyedData = p.imgRoiApplyed->getDataArray();
128 roiData = p.roi->getDataArray();
134 SLM_ASSERT(
"Null data array pointer", imgData && roiData && imgRoiApplyedData);
138 ImgType* imIt = imgHelper.
begin<ImgType>();
139 ImgType* imRoiIt = imgRoiApplyedHelper.
begin<ImgType>();
140 RoiType* roiIt = roiHelper.
begin<RoiType>();
142 const ImgType* imEnd = imIt + imgData->getNumberOfElements();
144 for (; result && imIt != imEnd; ++imIt, ++roiIt, ++imRoiIt)
146 result = result && ( (*roiIt == 0) ? (*imRoiIt == 0) : (*imIt == *imRoiIt) );
157 template<
typename IMAGE_TYPE>
166 bool Image::isRoiApplyed( ::fwData::Image::sptr image, ::fwData::Image::sptr roi, ::fwData::Image::sptr imgRoiApplyed )
168 SLM_ASSERT(
"Null image pointers", image && imgRoiApplyed && roi);
170 image->getSize() == imgRoiApplyed->getSize() && image->getSize() == roi->getSize());
174 param.imgRoiApplyed = imgRoiApplyed;
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...