Skip to content

Commit

Permalink
Merge branch 'main' into naegelejd/gadgetron-update
Browse files Browse the repository at this point in the history
  • Loading branch information
naegelejd committed Oct 23, 2024
2 parents 1197557 + 134b338 commit 12a1e24
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/actions/configure-mrd-build-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Configure MRD Build Environment
description: Configures the conda development environment

# The following inputs are currently expected environment variables:
# YARDL_VERSION, e.g. 0.6.2
# CONDA_CACHE_NUMBER, e.g. 0
# YARDL_VERSION
# CONDA_CACHE_NUMBER

runs:
using: composite
Expand Down
8 changes: 4 additions & 4 deletions cpp/mrd-tools/ismrmrd_to_mrd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

void print_usage(std::string program_name) {
std::cerr << "Usage: " << program_name << std::endl;
std::cerr << " -i|--input-file <input ISMRMRD stream> (default: stdin)" << std::endl;
std::cerr << " -o|--output-file <output MRD stream> (default: stdout)" << std::endl;
std::cerr << " -i|--input <input ISMRMRD stream> (default: stdin)" << std::endl;
std::cerr << " -o|--output <output MRD stream> (default: stdout)" << std::endl;
std::cerr << " -h|--help" << std::endl;
}

Expand All @@ -28,7 +28,7 @@ int main(int argc, char** argv) {
if (*current_arg == "--help" || *current_arg == "-h") {
print_usage(args[0]);
return 0;
} else if (*current_arg == "--input-file" || *current_arg == "-i") {
} else if (*current_arg == "--input" || *current_arg == "-i") {
current_arg++;
if (current_arg == args.end()) {
std::cerr << "Missing input file" << std::endl;
Expand All @@ -37,7 +37,7 @@ int main(int argc, char** argv) {
}
input_path = *current_arg;
current_arg++;
} else if (*current_arg == "--output-file" || *current_arg == "-o") {
} else if (*current_arg == "--output" || *current_arg == "-o") {
current_arg++;
if (current_arg == args.end()) {
std::cerr << "Missing output file" << std::endl;
Expand Down
4 changes: 2 additions & 2 deletions cpp/mrd-tools/mrd_image_stream_to_png.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

void print_usage(std::string program_name) {
std::cerr << "Usage: " << program_name << std::endl;
std::cerr << " -i|--input-file <input MRD stream> (default: stdin)" << std::endl;
std::cerr << " -i|--input <input MRD stream> (default: stdin)" << std::endl;
std::cerr << " -o|--output-prefix <output file prefix> (default: image_)" << std::endl;
std::cerr << " -h|--help" << std::endl;
}
Expand All @@ -21,7 +21,7 @@ int main(int argc, char** argv) {
if (*current_arg == "--help" || *current_arg == "-h") {
print_usage(args[0]);
return 0;
} else if (*current_arg == "--input-file" || *current_arg == "-i") {
} else if (*current_arg == "--input" || *current_arg == "-i") {
current_arg++;
if (current_arg == args.end()) {
std::cerr << "Missing input file" << std::endl;
Expand Down
5 changes: 2 additions & 3 deletions cpp/mrd-tools/mrd_phantom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ int main(int argc, char** argv) {

auto print_usage = [&]() {
std::cerr << "Usage: " << argv[0] << std::endl;
std::cerr << " -o|--output-file <output stream> (default: stdout)" << std::endl;
std::cerr << " -o|--output <output stream> (default: stdout)" << std::endl;
std::cerr << " -c|--coils <number of coils> (default: " << ncoils << ")" << std::endl;
std::cerr << " -m|--matrix <matrix size> (default: " << matrix << ")" << std::endl;
std::cerr << " -r|--repetitions <repetitions> (default: " << repetitions << ")" << std::endl;
Expand All @@ -69,7 +69,7 @@ int main(int argc, char** argv) {
if (*current_arg == "--help" || *current_arg == "-h") {
print_usage();
return 0;
} else if (*current_arg == "--output-file" || *current_arg == "-o") {
} else if (*current_arg == "--output" || *current_arg == "-o") {
current_arg++;
if (current_arg == args.end()) {
std::cerr << "Missing output file" << std::endl;
Expand Down Expand Up @@ -135,7 +135,6 @@ int main(int argc, char** argv) {
if (filename.empty()) {
w = std::make_unique<mrd::binary::MrdWriter>(std::cout);
} else {
std::remove(filename.c_str());
w = std::make_unique<mrd::binary::MrdWriter>(filename);
}

Expand Down
8 changes: 4 additions & 4 deletions cpp/mrd-tools/mrd_stream_recon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ void remove_oversampling(mrd::Acquisition& acq, const mrd::EncodingType& enc) {

void print_usage(std::string program_name) {
std::cerr << "Usage: " << program_name << std::endl;
std::cerr << " -i|--input-file <input MRD stream> (default: stdin)" << std::endl;
std::cerr << " -o|--output-file <output MRD stream> (default: stdout)" << std::endl;
std::cerr << " -i|--input <input MRD stream> (default: stdin)" << std::endl;
std::cerr << " -o|--output <output MRD stream> (default: stdout)" << std::endl;
std::cerr << " -h|--help" << std::endl;
}

Expand All @@ -48,7 +48,7 @@ int main(int argc, char** argv) {
if (*current_arg == "--help" || *current_arg == "-h") {
print_usage(args[0]);
return 0;
} else if (*current_arg == "--input-file" || *current_arg == "-i") {
} else if (*current_arg == "--input" || *current_arg == "-i") {
current_arg++;
if (current_arg == args.end()) {
std::cerr << "Missing input file" << std::endl;
Expand All @@ -57,7 +57,7 @@ int main(int argc, char** argv) {
}
input_path = *current_arg;
current_arg++;
} else if (*current_arg == "--output-file" || *current_arg == "-o") {
} else if (*current_arg == "--output" || *current_arg == "-o") {
current_arg++;
if (current_arg == args.end()) {
std::cerr << "Missing output file" << std::endl;
Expand Down
8 changes: 4 additions & 4 deletions cpp/mrd-tools/mrd_to_ismrmrd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

void print_usage(std::string program_name) {
std::cerr << "Usage: " << program_name << std::endl;
std::cerr << " -i|--input-file <input MRD stream> (default: stdin)" << std::endl;
std::cerr << " -o|--output-file <output ISMRMRD stream> (default: stdout)" << std::endl;
std::cerr << " -i|--input <input MRD stream> (default: stdin)" << std::endl;
std::cerr << " -o|--output <output ISMRMRD stream> (default: stdout)" << std::endl;
std::cerr << " -h|--help" << std::endl;
}

Expand All @@ -27,7 +27,7 @@ int main(int argc, char** argv) {
if (*current_arg == "--help" || *current_arg == "-h") {
print_usage(args[0]);
return 0;
} else if (*current_arg == "--input-file" || *current_arg == "-i") {
} else if (*current_arg == "--input" || *current_arg == "-i") {
current_arg++;
if (current_arg == args.end()) {
std::cerr << "Missing input file" << std::endl;
Expand All @@ -36,7 +36,7 @@ int main(int argc, char** argv) {
}
input_path = *current_arg;
current_arg++;
} else if (*current_arg == "--output-file" || *current_arg == "-o") {
} else if (*current_arg == "--output" || *current_arg == "-o") {
current_arg++;
if (current_arg == args.end()) {
std::cerr << "Missing output file" << std::endl;
Expand Down
15 changes: 14 additions & 1 deletion test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,18 @@ cat py2py_images.bin | python -m mrd.tools.export_png_images -o py2py
ifmatlab && cat mat2mat_images.bin | ./matlab_export_png_images.sh mat2mat


echo Testing again using named pipes
test -e recon_in.pipe || mkfifo recon_in.pipe
test -e recon_out.pipe || mkfifo recon_out.pipe

mrd_phantom --output recon_in.pipe &
mrd_stream_recon --input recon_in.pipe --output recon_out.pipe &
mrd_image_stream_to_png --input recon_out.pipe

python -m mrd.tools.phantom --output recon_in.pipe &
python -m mrd.tools.stream_recon --input recon_in.pipe --output recon_out.pipe &
python -m mrd.tools.export_png_images --input recon_out.pipe


echo Cleaning up
rm -f ./*.bin ./*.png
rm -f ./*.bin ./*.png ./*.pipe

0 comments on commit 12a1e24

Please sign in to comment.