File tree 3 files changed +19
-6
lines changed
applications/endoscopy_tool_tracking
3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,7 @@ class App : public holoscan::Application {
273
273
std::string source_ = " replayer" ;
274
274
std::string visualizer_name = " holoviz" ;
275
275
Record record_type_ = Record::NONE;
276
- std::string datapath = " data/endoscopy " ;
276
+ std::string datapath = " " ;
277
277
};
278
278
279
279
/* * Helper function to parse the command line arguments */
@@ -309,12 +309,15 @@ int main(int argc, char** argv) {
309
309
if (data_directory.empty ()) {
310
310
// Get the input data environment variable
311
311
auto input_path = std::getenv (" HOLOSCAN_INPUT_PATH" );
312
- if (input_path == nullptr || input_path[0 ] == ' \0 ' ) {
312
+ if (input_path != nullptr && input_path[0 ] != ' \0 ' ) {
313
+ data_directory = std::string (input_path);
314
+ } else if (std::filesystem::is_directory (std::filesystem::current_path () / " data/endoscopy" )) {
315
+ data_directory = std::string ((std::filesystem::current_path () / " data/endoscopy" ).c_str ());
316
+ } else {
313
317
HOLOSCAN_LOG_ERROR (
314
318
" Input data not provided. Use --data or set HOLOSCAN_INPUT_PATH environment variable." );
315
319
exit (-1 );
316
320
}
317
- data_directory = std::string (input_path);
318
321
}
319
322
320
323
if (config_path.empty ()) {
Original file line number Diff line number Diff line change @@ -275,6 +275,7 @@ def compose(self):
275
275
276
276
277
277
if __name__ == "__main__" :
278
+ default_data_path = f"{ os .getcwd ()} /data/endoscopy"
278
279
# Parse args
279
280
parser = ArgumentParser (description = "Endoscopy tool tracking demo application." )
280
281
parser .add_argument (
@@ -303,8 +304,8 @@ def compose(self):
303
304
parser .add_argument (
304
305
"-d" ,
305
306
"--data" ,
306
- default = os .environ .get ("HOLOSCAN_INPUT_PATH" , None ),
307
- help = ("Set the data path" ),
307
+ default = os .environ .get ("HOLOSCAN_INPUT_PATH" , default_data_path ),
308
+ help = ("Set the data path (default: %(default)s). " ),
308
309
)
309
310
args = parser .parse_args ()
310
311
record_type = args .record_type
@@ -316,6 +317,15 @@ def compose(self):
316
317
else :
317
318
config_file = args .config
318
319
320
+ # handle case where HOLOSCAN_INPUT_PATH is set with no value
321
+ if len (args .data ) == 0 :
322
+ args .data = default_data_path
323
+
324
+ if not os .path .isdir (args .data ):
325
+ raise ValueError (
326
+ f"Data path '{ args .data } ' does not exist. Use --data or set HOLOSCAN_INPUT_PATH environment variable."
327
+ )
328
+
319
329
app = EndoscopyApp (record_type = record_type , source = args .source , data = args .data )
320
330
app .config (config_file )
321
331
app .run ()
Original file line number Diff line number Diff line change @@ -841,7 +841,7 @@ for k, v in obj[project_type]["run"].items():
841
841
workdir=" cd ${holohub_build_dir} "
842
842
fi
843
843
844
- local environment=" export PYTHONPATH=\$ {PYTHONPATH}:${holoscan_sdk_install} /../../../python/lib:${holohub_build_dir} /python/lib:${SCRIPT_DIR} && export HOLOHUB_DATA_PATH=${holohub_data_dir} && export HOLOSCAN_INPUT_PATH=${holohub_data_dir} "
844
+ local environment=" export PYTHONPATH=\$ {PYTHONPATH}:${holoscan_sdk_install} /../../../python/lib:${holohub_build_dir} /python/lib:${SCRIPT_DIR} && export HOLOHUB_DATA_PATH=${holohub_data_dir} && export HOLOSCAN_INPUT_PATH=${HOLOSCAN_INPUT_PATH := $ holohub_data_dir } "
845
845
local reset_environment=" export PYTHONPATH=${PYTHONPATH} && export HOLOHUB_DATA_PATH=\" ${HOLOHUB_DATA_PATH} \" && export HOLOSCAN_INPUT_PATH=\" ${HOLOSCAN_INPUT_PATH} \" "
846
846
847
847
if [ ${verbose} ]; then
You can’t perform that action at this time.
0 commit comments