Skip to content

Commit

Permalink
Merge pull request #217 from zhujun98/gui
Browse files Browse the repository at this point in the history
Change GUI cmd interface
  • Loading branch information
zhujun98 authored Sep 26, 2023
2 parents dc3929e + 77ab065 commit b0c5496
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
6 changes: 3 additions & 3 deletions docs/docs/user_guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ conda activate recastx-gui

You can specify the reconstruction server
```sh
recastx-gui --recon-host <hostname>
recastx-gui --server <hostname:port>
```

or make use of local port forwarding
```sh
ssh -L 9971:localhost:9971 <hostname>
ssh -L <port>:localhost:<port> <hostname>
recastx-gui
```

You can also start the GUI on a node with [NoMachine](https://www.psi.ch/en/photon-science-data-services/remote-interactive-access
) installed
```sh
vglrun recastx-gui --recon-host <hostname>
vglrun recastx-gui --server <hostname:port>
```

## Step 3: Streaming the data
Expand Down
2 changes: 1 addition & 1 deletion gui/include/rpc_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class RpcClient {

static std::queue<DataType>& packets();

RpcClient(const std::string& hostname, int port);
explicit RpcClient(const std::string& address);

~RpcClient();

Expand Down
8 changes: 3 additions & 5 deletions gui/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ int main(int argc, char** argv) {
po::options_description desc("Options");
desc.add_options()
("help,h", "print help message")
("recon-host", po::value<std::string>()->default_value("localhost"),
"hostname of the reconstruction server")
("rpc-port", po::value<int>()->default_value(9971),
"port of the RPC server. ")
("server", po::value<std::string>()->default_value("localhost:9971"),
"address (<hostname>:<port>) of the reconstruction server")
;

po::variables_map opts;
Expand All @@ -48,7 +46,7 @@ int main(int argc, char** argv) {

auto& app = Application::instance();

RpcClient rpc_client(opts["recon-host"].as<std::string>(), opts["rpc-port"].as<int>());
RpcClient rpc_client(opts["server"].as<std::string>());

Scene3d scene(&rpc_client);

Expand Down
7 changes: 3 additions & 4 deletions gui/src/rpc_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ using namespace std::string_literals;

std::queue<RpcClient::DataType>& RpcClient::packets() { return packets_; }

RpcClient::RpcClient(const std::string& hostname, int port) {
RpcClient::RpcClient(const std::string& address) {

grpc::ChannelArguments ch_args;
ch_args.SetMaxReceiveMessageSize(K_MAX_RPC_CLIENT_RECV_MESSAGE_SIZE);
channel_ = grpc::CreateCustomChannel(hostname + ":"s + std::to_string(port),
grpc::InsecureChannelCredentials(),
ch_args);
channel_ = grpc::CreateCustomChannel(
address, grpc::InsecureChannelCredentials(), ch_args);

control_stub_ = rpc::Control::NewStub(channel_);
imageproc_stub_ = rpc::Imageproc::NewStub(channel_);
Expand Down

0 comments on commit b0c5496

Please sign in to comment.