Code Monkey home page Code Monkey logo

Comments (5)

jcfr avatar jcfr commented on June 23, 2024

Most likely incorrect test:

if( 

   ( 

     ( 

        (!qcResult.Get_result()  & InterlaceWiseCheckBit) == InterlaceWiseCheckBit 

     )

        ||
 
     (

        !(

           this->GetProtocol().GetSliceCheckProtocol().bQuitOnCheckFailure ||
           this->GetProtocol().GetInterlaceCheckProtocol().bQuitOnCheckFailure

         )

     )

   )


  && this->GetProtocol().GetGradientCheckProtocol().bCheck 


)

vs

similar but most likely correct test

if( 

   ( 
      (
         !( 
             (qcResult.Get_result()  & InterlaceWiseCheckBit) == InterlaceWiseCheckBit

          ) 

      ) 

           ||
          
      (!

            (
              this->GetProtocol().GetSliceCheckProtocol().bQuitOnCheckFailure ||
              this->GetProtocol().GetInterlaceCheckProtocol().bQuitOnCheckFailure
            ) 

      ) 

   ) 
)

from dtiprep.

jcfr avatar jcfr commented on June 23, 2024

Then, based on my previous comment I think the correct test should be:

if( 

   ( 

     !(   // <------- Logical not moved outside

        (qcResult.Get_result()  & InterlaceWiseCheckBit) == InterlaceWiseCheckBit 

     )

        ||
 
     (

        !(

           this->GetProtocol().GetSliceCheckProtocol().bQuitOnCheckFailure ||
           this->GetProtocol().GetInterlaceCheckProtocol().bQuitOnCheckFailure

         )

     )

   )


  && this->GetProtocol().GetGradientCheckProtocol().bCheck 


)

from dtiprep.

jcfr avatar jcfr commented on June 23, 2024

Which in turn can be rewritten as this more readable version:

bool doInterlaceWiseCheck = (qcResult.Get_result()  & InterlaceWiseCheckBit) == InterlaceWiseCheckBit;

bool doQuitOnCheckFailure =
  this->GetProtocol().GetSliceCheckProtocol().bQuitOnCheckFailure ||
  this->GetProtocol().GetInterlaceCheckProtocol().bQuitOnCheckFailure;

if(
   ( !doInterlaceWiseCheck || !doQuitOnCheckFailure )
   && this->GetProtocol().GetGradientCheckProtocol().bCheck 
)
  {
  // ...
  }

from dtiprep.

styner avatar styner commented on June 23, 2024

Thanks JC, I think you are correct. DTIPrep has (in parts) some really ugly code (2 postdocs who weren't the best coders worked on it), sorry!

from dtiprep.

jcfr avatar jcfr commented on June 23, 2024

Hi @styner ,

No need to be sorry. It is nature of the work.

Improving our processes, providing education and resources to increase quality of our softwares, and also including software maintenance in our grants and funding requests are all helpful actions 😄

The code being open-source with a permissive license, and available on GitHub with the option of doing pull requests is one of the many steps in the right direction.

I think some of the take home messages would be:

  • to care for build warnings and try to either address them or explicitly disable them. They often reveals useful information.
  • add tests

Thanks again for reviewing and integrating these changes.
Jc

from dtiprep.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.