Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command: fixeltransform #3033

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft

New command: fixeltransform #3033

wants to merge 2 commits into from

Conversation

Lestropie
Copy link
Member

Functionality required to establish spatial correspondence between two independent fixel datasets.

@Lestropie Lestropie self-assigned this Nov 6, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions


using dir_type = Eigen::Vector3f;

void run() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'run' has cognitive complexity of 32 (threshold 25) [readability-function-cognitive-complexity]

void run() {
     ^
Additional context

cmd/fixeltransform.cpp:84: +1, including nesting penalty of 0, nesting level increased to 1

  for (auto &H : fixel_data_headers) {
  ^

cmd/fixeltransform.cpp:85: +2, including nesting penalty of 1, nesting level increased to 2

    if (H.size(1) > 1)
    ^

cmd/fixeltransform.cpp:91: +1, including nesting penalty of 0, nesting level increased to 1

  INFO(str(fixel_data_headers.size()) + " fixel data files to be transformed");
  ^

core/exception.h:74: expanded from macro 'INFO'

  if (MR::App::log_level >= 2)                                                                                         \
  ^

cmd/fixeltransform.cpp:114: +1, including nesting penalty of 0, nesting level increased to 1

  for (auto l_voxel = Loop("Computing fixel transformations",
  ^

cmd/fixeltransform.cpp:118: +2, including nesting penalty of 1, nesting level increased to 2

    if (input_index_image.scanner(Eigen::Vector3f(warp_image.row(3)))) {
    ^

cmd/fixeltransform.cpp:121: +3, including nesting penalty of 2, nesting level increased to 3

      if (count) {
      ^

cmd/fixeltransform.cpp:125: +4, including nesting penalty of 3, nesting level increased to 4

        for (auto l_fixel = Fixel::Loop(input_index_image)(input_directions_image); l_fixel; ++l_fixel) {
        ^

cmd/fixeltransform.cpp:128: +5, including nesting penalty of 4, nesting level increased to 5

          for (size_t fixel_datafile_index = 0; fixel_datafile_index != fixel_data_images.size();
          ^

cmd/fixeltransform.cpp:138: +1, including nesting penalty of 0, nesting level increased to 1

  INFO("Number of input vs. output fixels: " + str(nfixels_in) + " -> " + str(nfixels_out));
  ^

core/exception.h:74: expanded from macro 'INFO'

  if (MR::App::log_level >= 2)                                                                                         \
  ^

cmd/fixeltransform.cpp:142: +1, including nesting penalty of 0, nesting level increased to 1

  for (const auto i : usage_counts) {
  ^

cmd/fixeltransform.cpp:143: +2, including nesting penalty of 1, nesting level increased to 2

    while (i >= usage_frequencies.size())
    ^

cmd/fixeltransform.cpp:147: +1, including nesting penalty of 0, nesting level increased to 1

  INFO("Frequency distribution of utilisation of input fixels:");
  ^

core/exception.h:74: expanded from macro 'INFO'

  if (MR::App::log_level >= 2)                                                                                         \
  ^

cmd/fixeltransform.cpp:148: +1, including nesting penalty of 0, nesting level increased to 1

  for (index_type count = 0; count != usage_frequencies.size(); ++count) {
  ^

cmd/fixeltransform.cpp:149: +2, including nesting penalty of 1, nesting level increased to 2

    INFO("  " + str(count) + ": " + str(usage_frequencies[count]));
    ^

core/exception.h:74: expanded from macro 'INFO'

  if (MR::App::log_level >= 2)                                                                                         \
  ^

cmd/fixeltransform.cpp:167: +1, including nesting penalty of 0, nesting level increased to 1

  for (auto l = Loop(count_header)(count_buffer, offset_buffer, output_index_image); l; ++l) {
  ^

cmd/fixeltransform.cpp:174: +1, including nesting penalty of 0, nesting level increased to 1

  for (index_type i = 0; i != nfixels_out; ++i) {
  ^

cmd/fixeltransform.cpp:180: +1, including nesting penalty of 0, nesting level increased to 1

  for (size_t fixel_datafile_index = 0; fixel_datafile_index != fixel_data_images.size(); ++fixel_datafile_index) {
  ^

cmd/fixeltransform.cpp:186: +2, including nesting penalty of 1, nesting level increased to 2

    for (auto l = Loop(0)(output_datafile_image); l; ++l)
    ^

using dir_type = Eigen::Vector3f;

void run() {
std::string input_fixel_directory = argument[0];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'input_fixel_directory' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]

Suggested change
std::string input_fixel_directory = argument[0];
std::string const input_fixel_directory = argument[0];

auto warp_image = warp_header.get_image<float>();
Adapter::Jacobian<Image<float>> jacobian_adapter(warp_image);

std::string output_fixel_directory = argument[2];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'output_fixel_directory' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]

Suggested change
std::string output_fixel_directory = argument[2];
std::string const output_fixel_directory = argument[2];

if (input_index_image.scanner(Eigen::Vector3f(warp_image.row(3)))) {
input_index_image.index(3) = 0;
const index_type count = input_index_image.value();
if (count) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: implicit conversion 'index_type' (aka 'unsigned int') -> bool [readability-implicit-bool-conversion]

Suggested change
if (count) {
if (count != 0u) {

if (count) {
count_buffer.value() = count;
offset_buffer.value() = rotated_directions.size();
Eigen::Matrix<float, 3, 3> transform = jacobian_adapter.value().inverse();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'transform' of type 'Eigen::Matrix<float, 3, 3>' can be declared 'const' [misc-const-correctness]

Suggested change
Eigen::Matrix<float, 3, 3> transform = jacobian_adapter.value().inverse();
Eigen::Matrix<float, 3, 3> const transform = jacobian_adapter.value().inverse();

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions


using dir_type = Eigen::Vector3f;

void run() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'run' has cognitive complexity of 32 (threshold 25) [readability-function-cognitive-complexity]

void run() {
     ^
Additional context

cmd/fixeltransform.cpp:84: +1, including nesting penalty of 0, nesting level increased to 1

  for (auto &H : fixel_data_headers) {
  ^

cmd/fixeltransform.cpp:85: +2, including nesting penalty of 1, nesting level increased to 2

    if (H.size(1) > 1)
    ^

cmd/fixeltransform.cpp:91: +1, including nesting penalty of 0, nesting level increased to 1

  INFO(str(fixel_data_headers.size()) + " fixel data files to be transformed");
  ^

core/exception.h:74: expanded from macro 'INFO'

  if (MR::App::log_level >= 2)                                                                                         \
  ^

cmd/fixeltransform.cpp:114: +1, including nesting penalty of 0, nesting level increased to 1

  for (auto l_voxel = Loop("Computing fixel transformations",
  ^

cmd/fixeltransform.cpp:118: +2, including nesting penalty of 1, nesting level increased to 2

    if (input_index_image.scanner(Eigen::Vector3f(warp_image.row(3)))) {
    ^

cmd/fixeltransform.cpp:121: +3, including nesting penalty of 2, nesting level increased to 3

      if (count > 0) {
      ^

cmd/fixeltransform.cpp:125: +4, including nesting penalty of 3, nesting level increased to 4

        for (auto l_fixel = Fixel::Loop(input_index_image)(input_directions_image); l_fixel; ++l_fixel) {
        ^

cmd/fixeltransform.cpp:128: +5, including nesting penalty of 4, nesting level increased to 5

          for (size_t fixel_datafile_index = 0; fixel_datafile_index != fixel_data_images.size();
          ^

cmd/fixeltransform.cpp:138: +1, including nesting penalty of 0, nesting level increased to 1

  INFO("Number of input vs. output fixels: " + str(nfixels_in) + " -> " + str(nfixels_out));
  ^

core/exception.h:74: expanded from macro 'INFO'

  if (MR::App::log_level >= 2)                                                                                         \
  ^

cmd/fixeltransform.cpp:142: +1, including nesting penalty of 0, nesting level increased to 1

  for (const auto i : usage_counts) {
  ^

cmd/fixeltransform.cpp:143: +2, including nesting penalty of 1, nesting level increased to 2

    while (i >= usage_frequencies.size())
    ^

cmd/fixeltransform.cpp:147: +1, including nesting penalty of 0, nesting level increased to 1

  INFO("Frequency distribution of utilisation of input fixels:");
  ^

core/exception.h:74: expanded from macro 'INFO'

  if (MR::App::log_level >= 2)                                                                                         \
  ^

cmd/fixeltransform.cpp:148: +1, including nesting penalty of 0, nesting level increased to 1

  for (index_type count = 0; count != usage_frequencies.size(); ++count) {
  ^

cmd/fixeltransform.cpp:149: +2, including nesting penalty of 1, nesting level increased to 2

    INFO("  " + str(count) + ": " + str(usage_frequencies[count]));
    ^

core/exception.h:74: expanded from macro 'INFO'

  if (MR::App::log_level >= 2)                                                                                         \
  ^

cmd/fixeltransform.cpp:167: +1, including nesting penalty of 0, nesting level increased to 1

  for (auto l = Loop(count_header)(count_buffer, offset_buffer, output_index_image); l; ++l) {
  ^

cmd/fixeltransform.cpp:174: +1, including nesting penalty of 0, nesting level increased to 1

  for (index_type i = 0; i != nfixels_out; ++i) {
  ^

cmd/fixeltransform.cpp:180: +1, including nesting penalty of 0, nesting level increased to 1

  for (size_t fixel_datafile_index = 0; fixel_datafile_index != fixel_data_images.size(); ++fixel_datafile_index) {
  ^

cmd/fixeltransform.cpp:186: +2, including nesting penalty of 1, nesting level increased to 2

    for (auto l = Loop(0)(output_datafile_image); l; ++l)
    ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant