void ZDvidTile::update(int z) { if (m_z != z || m_image == NULL) { #if defined(_ENABLE_LIBDVIDCPP_2) std::vector<int> offset(3); offset[0] = m_ix; offset[1] = m_iy; offset[2] = z; tic(); try { libdvid::DVIDNodeService service(getDvidTarget().getAddressWithPort(), getDvidTarget().getUuid()); libdvid::BinaryDataPtr data = service.get_tile_slice_binary( "tiles", libdvid::XY, m_res.getLevel(), offset); if (data->length() > 0) { loadDvidSlice(data->get_raw(), data->length(), z); m_image->setScale(1.0 / m_res.getScale(), 1.0 / m_res.getScale()); m_image->setOffset(-getX(), -getY()); } } catch (std::exception &e) { std::cout << e.what() << std::endl; } std::cout << "Tile level: " << m_res.getLevel() << std::endl; std::cout << "Tile reading time: " << toc() << std::endl; #else ZDvidUrl dvidUrl(getDvidTarget()); ZDvidBufferReader bufferReader; /* QFuture<void> result = QtConcurrent::run( &bufferReader, &ZDvidBufferReader::read, QString(dvidUrl.getTileUrl("graytiles", m_res.getLevel(), m_ix, m_iy, z).c_str())); result.waitForFinished(); */ tic(); bufferReader.read( dvidUrl.getTileUrl(getDvidTarget().getMultiscale2dName(), m_res.getLevel(), m_ix, m_iy, z).c_str()); QByteArray buffer = bufferReader.getBuffer(); std::cout << "Tile reading time: " << toc() << std::endl; // ZDvidTileInfo tileInfo = readTileInfo("graytiles"); if (!buffer.isEmpty()) { loadDvidSlice(buffer, z); // m_image->setScale(1.0 / m_res.getScale(), 1.0 / m_res.getScale()); // m_image->setOffset(-getX(), -getY()); // setResolutionLevel(m_res.getLevel()); } #endif } //m_z = z; }
std::string ZFlyEmSupervisor::getOwner(uint64_t bodyId) const { std::string owner; ZDvidBufferReader bufferReader; bufferReader.read( QString("%1/%2").arg(getCheckoutUrl(getDvidTarget().getUuid()).c_str()). arg(bodyId)); ZJsonObject obj; obj.decodeString(bufferReader.getBuffer()); if (obj.hasKey("Client")) { owner = ZJsonParser::stringValue(obj["Client"]); } return owner; }
std::vector<std::string> ZFlyEmSupervisor::getUuidList() const { ZDvidBufferReader reader; reader.read(getUuidsUrl().c_str()); const QByteArray &buffer = reader.getBuffer(); std::vector<std::string> uuidList; if (!buffer.isEmpty()) { ZJsonArray obj; obj.decodeString(buffer.constData()); for (size_t i = 0; i < obj.size(); ++i) { uuidList.push_back(ZJsonParser::stringValue(obj.at(i))); } } return uuidList; // reader.read(ZDvidUrl) }