void Plugin::start() { ::fwMemory::BufferManager::sptr manager = ::fwMemory::BufferManager::getDefault(); const std::string modeKey = "loading_mode"; if ( this->getBundle()->hasParameter(modeKey) ) { ::fwCore::mt::WriteLock lock( manager->getMutex() ); std::string mode = this->getBundle()->getParameterValue(modeKey); if (mode == "lazy") { manager->setLoadingMode(::fwMemory::BufferManager::LAZY); SLM_INFO("Enabled lazy loading mode"); } else if (mode == "direct") { manager->setLoadingMode(::fwMemory::BufferManager::DIRECT); SLM_INFO("Enabled direct loading mode"); } else { SLM_ERROR("Unknown loading mode : '" + mode + "'"); } } }
void SplineReaderService::configuring( ) throw(::fwTools::Failed) { SLM_TRACE_FUNC(); ::fwRuntime::ConfigurationElementContainer::Iterator iter; for (iter = m_configuration->begin() ; iter != m_configuration->end() ; ++iter) { SLM_INFO((*iter)->getName()); if ((*iter)->getName() == "spline") { if((*iter)->hasAttribute("id")) { m_idSpline = boost::lexical_cast<int >((*iter)->getExistingAttributeValue("id").c_str()); SLM_INFO((*iter)->getExistingAttributeValue("id")); } if((*iter)->hasAttribute("nbSides")) { m_nbSides = boost::lexical_cast<int >((*iter)->getExistingAttributeValue("nbSides").c_str()); SLM_INFO((*iter)->getExistingAttributeValue("nbSides")); } if((*iter)->hasAttribute("radius")) { m_radius = boost::lexical_cast<double >((*iter)->getExistingAttributeValue("radius").c_str()); SLM_INFO((*iter)->getExistingAttributeValue("radius")); } if((*iter)->hasAttribute("matrix")) { objectMatrix = loadObjectTransformationMatrix3D((*iter)->getExistingAttributeValue("matrix")); isTransfo = true; OSLM_INFO("spline matrix: " << (*iter)->getExistingAttributeValue("matrix")); } ::fwRuntime::ConfigurationElementContainer::Iterator iter2; ::fwRuntime::ConfigurationElement::sptr m_configuration2 = m_configuration->findConfigurationElement("spline"); for (iter2 = m_configuration2->begin() ; iter2 != m_configuration2->end() ; ++iter2) { if ((*iter2)->getName() == "point" && (*iter2)->hasAttribute("id")) { ::fwData::Spline::point pt; pt.id = boost::lexical_cast<int >((*iter2)->getExistingAttributeValue("id").c_str()); SLM_INFO((*iter2)->getExistingAttributeValue("id")); pt.p[0] = pt.id * 100.0; pt.p[1] = 0.0; pt.p[2] = 0.0; pt.isVisible = false; m_points.push_back( pt ) ; } } } } }
void Plugin::start() throw(::fwRuntime::RuntimeException) { ::fwRuntime::profile::Profile::sptr profile = ::fwRuntime::profile::getCurrentProfile(); ANativeActivity* activity = profile->getApp()->activity; SLM_INFO(" Initialize NDKHelper"); // The jni initialization ndkGui::JNIHelper::Init(activity, HELPER_CLASS_NAME); SLM_INFO(" Initialize JUIHelper"); // The window initialization ndkGui::JUIWindow::Init(activity, JUIHELPER_CLASS_NAME); }
void SShowArray::updating() { ::fwData::Array::csptr array = this->getInput< ::fwData::Array >("array"); ::fwData::mt::ObjectReadLock readLock(array); SLM_ASSERT("No array.", array); ::fwDataTools::helper::ArrayGetter arrayHelper(array); const unsigned int* buffer = static_cast< const unsigned int* >( arrayHelper.getBuffer() ); std::stringstream str; std::ostream_iterator<unsigned int> coutIter(str, ", "); std::copy(buffer, buffer+10, coutIter ); SLM_INFO("Buffer : " + str.str()); }
void MemoryConsumption::updating() throw(::fwTools::Failed) { if(m_isIncreaseMode) { this->pushNewArray(m_memorySizeInBytes) ; } else { if( !memoryConsumer.empty() ) { SLM_INFO("Removing one fwData::Array") ; memoryConsumer.pop_back() ; } } }
void SSliceIndexDicomPullerEditor::readImage(std::size_t selectedSliceIndex) { // DicomSeries ::fwMedData::DicomSeries::csptr dicomSeries = this->getInOut< ::fwMedData::DicomSeries >("series"); SLM_ASSERT("DicomSeries should not be null !", dicomSeries); if( dicomSeries->getModality() != "CT" && dicomSeries->getModality() != "MR" && dicomSeries->getModality() != "XA") { return; } // Clear temporary seriesDB ::fwMedDataTools::helper::SeriesDB sDBTempohelper(m_tempSeriesDB); sDBTempohelper.clear(); // Creates unique temporary folder, no need to check if exists before (see ::fwTools::System::getTemporaryFolder) ::boost::filesystem::path path = ::fwTools::System::getTemporaryFolder("dicom"); ::boost::filesystem::path tmpPath = path / "tmp"; SLM_INFO("Create " + tmpPath.string()); ::boost::filesystem::create_directories(tmpPath); const auto& binaries = dicomSeries->getDicomContainer(); auto iter = binaries.find(selectedSliceIndex); OSLM_ASSERT("Index '"<<selectedSliceIndex<<"' is not found in DicomSeries", iter != binaries.end()); const ::fwMemory::BufferObject::sptr bufferObj = iter->second; const ::fwMemory::BufferObject::Lock lockerDest(bufferObj); const char* buffer = static_cast<char*>(lockerDest.getBuffer()); const size_t size = bufferObj->getSize(); ::boost::filesystem::path dest = tmpPath / std::to_string(selectedSliceIndex); ::boost::filesystem::ofstream fs(dest, std::ios::binary|std::ios::trunc); FW_RAISE_IF("Can't open '" << tmpPath << "' for write.", !fs.good()); fs.write(buffer, size); fs.close(); // Read image m_dicomReader.lock()->setFolder(tmpPath); if(!m_dicomReader.expired()) { m_dicomReader.lock()->update(); if(m_dicomReader.expired() || m_dicomReader.lock()->isStopped()) { return; } } else { return; } //Copy image ::fwMedData::ImageSeries::sptr imageSeries; if(m_tempSeriesDB->getContainer().size() > 0) { imageSeries = ::fwMedData::ImageSeries::dynamicCast(*(m_tempSeriesDB->getContainer().begin())); } if(imageSeries) { ::fwData::Image::sptr newImage = imageSeries->getImage(); ::fwData::Image::SizeType newSize = newImage->getSize(); newImage->setField(::fwDataTools::fieldHelper::Image::m_axialSliceIndexId, m_axialIndex); m_frontalIndex->setValue(static_cast<int>(newSize[0]/2)); newImage->setField(::fwDataTools::fieldHelper::Image::m_frontalSliceIndexId, m_frontalIndex); m_sagittalIndex->setValue(static_cast<int>(newSize[1]/2)); newImage->setField(::fwDataTools::fieldHelper::Image::m_sagittalSliceIndexId, m_sagittalIndex); this->setOutput("image", newImage); } ::boost::system::error_code ec; ::boost::filesystem::remove_all(path, ec); SLM_ERROR_IF("remove_all error for path " + path.string() + ": " + ec.message(), ec.value()); }
void Logger::information(const std::string& message) { ::fwLog::Log log(::fwLog::Log::INFORMATION, message); m_logContainer.push_back(log); SLM_INFO(message); }