7 #include "fwDataTools/fieldHelper/Image.hpp" 8 #include "fwDataTools/helper/Image.hpp" 10 #include "fwDataTools/fieldHelper/MedicalImageHelpers.hpp" 11 #include "fwDataTools/helper/Composite.hpp" 12 #include "fwDataTools/helper/Field.hpp" 14 #include <fwCom/Signal.hpp> 15 #include <fwCom/Signal.hxx> 16 #include <fwCom/Signals.hpp> 18 #include <fwData/Composite.hpp> 19 #include <fwData/PointList.hpp> 20 #include <fwData/TransferFunction.hpp> 31 m_sliceModified(false)
35 m_lock = image->getDataArray()->getBufferObject()->lock();
49 bool fieldIsCreated =
false;
54 ::fwData::PointList::sptr pl = ::fwData::PointList::New();
56 fieldIsCreated =
true;
59 return fieldIsCreated;
66 bool fieldIsCreated =
false;
68 ::fwData::Composite::sptr tfPool;
74 tfPool = ::fwData::Composite::New();
78 fieldHelper.
setField(poolFieldName, tfPool);
82 fieldIsCreated =
true;
86 if(tfPool->find(defaultTFName) == tfPool->end())
88 ::fwData::TransferFunction::sptr tf = ::fwData::TransferFunction::createDefaultTF();
89 if (m_image->getWindowWidth() != 0 )
91 tf->setWindow( m_image->getWindowWidth() );
92 tf->setLevel( m_image->getWindowCenter() );
98 ::fwData::TransferFunction::TFValuePairType wlMinMax(min, max);
99 tf->setWLMinMax(wlMinMax);
103 compositeHelper.
add(defaultTFName, tf);
107 return fieldIsCreated;
114 bool fieldIsCreated =
false;
116 const ::fwData::Image::SizeType& imageSize = m_image->getSize();
126 if ( !(axialIdx && frontalIdx && sagittalIdx) )
129 axialIdx = ::fwData::Integer::New(-1);
132 frontalIdx = ::fwData::Integer::New(-1);
135 sagittalIdx = ::fwData::Integer::New(-1);
138 fieldIsCreated =
true;
142 "Information on image slice index is not correct, miss one of these fields : " 143 "m_axialSliceIndexId, m_frontalSliceIndexId, m_sagittalSliceIndexId.",
144 axialIdx && frontalIdx && sagittalIdx
148 if( axialIdx->value() < 0 ||
static_cast< int>(imageSize[2]) < axialIdx->value() )
150 axialIdx->value() =
static_cast< ::fwData::Integer::ValueType
>(imageSize[2] / 2);
151 fieldIsCreated =
true;
154 if( frontalIdx->value() < 0 ||
static_cast< int>(imageSize[1]) < frontalIdx->value() )
156 frontalIdx->value() =
static_cast< ::fwData::Integer::ValueType
>(imageSize[1] / 2);
157 fieldIsCreated =
true;
160 if( sagittalIdx->value() < 0 ||
static_cast< int>(imageSize[0]) < sagittalIdx->value() )
162 sagittalIdx->value() =
static_cast< ::fwData::Integer::ValueType
>(imageSize[0] / 2);
163 fieldIsCreated =
true;
166 m_sliceModified |= fieldIsCreated;
167 return fieldIsCreated;
184 sig->asyncEmit(axialIdx->getValue(), frontalIdx->
getValue(), sagittalIdx->
getValue());
202 SizeType size = m_image->getSize();
203 IndexType offset = x + size[0]*y + z*size[0]*size[1];
211 std::uint8_t imagePixelSize = m_image->getType().sizeOf() * m_image->getNumberOfComponents();
212 BufferType* buf = static_cast < BufferType* > (this->
getBuffer());
213 BufferIndexType bufIndex = index * imagePixelSize;
214 return buf + bufIndex;
221 std::uint8_t imagePixelSize = m_image->getType().sizeOf() * m_image->getNumberOfComponents();
222 BufferType* buf = static_cast < BufferType* > (this->
getPixelBuffer(index));
224 std::copy(pixBuf, pixBuf+imagePixelSize, buf);
230 SizeType::value_type y,
231 SizeType::value_type z )
233 return m_image->getType().toString(this->
getPixelBuffer(x, y, z));
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_SLICE_INDEX_MODIFIED_SIG
Type of signal when image's buffer is added.
static FWDATA_API const std::string s_DEFAULT_TF_NAME
Default transfer function name.
This class contains an integer value. Integer object is essentially used as a field in other objects...
T getValue() const noexcept
get the value
base class for BufferObject Lock
LockBase< T >::BufferType getBuffer() const
Returns BufferObject's buffer pointer.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG
Key in m_signals map of signal m_sigModified.
This class defines a composite object.