DivideImageFilter with a constant?

The documentation for this deprecated filter:

Says DivideImageFilter can do the same thing, however I can’t find any detail on how, is it possible?

Divide, Multiply etc filters have a SetConstant methods, e.g. SetConstant2 to set the second image to the provided constant.

1 Like

Thanks @dzenanz

Where would I have found that? I can’t find any methods on the https://itk.org/Doxygen/html/classitk_1_1DivideImageFilter.html page

On that page, expand heading “Public methods inherited from BinaryGenerator…”

Ahhh, that does not get included in a global text search if its closed :slight_smile:

Also, if your editor has code completion, write filter->Set and invoke auto-complete (Ctrl+space usually) or wait a little bit to get a list of methods starting with Set.

Good point, I should figure out how to make Atom properly parse and complete this stuff.

Or use an IDE instead of a text editor :smiley:

I am not very hopeful about text editors giving good auto-complete results on heavily templated code. Even Visual Studio and Qt Creator are frequently losing the auto-complete during constant git version updates in my working copy :frowning:

https://atom.io/ can definitely do it, but as mentioned in other threads, I’m just getting up to speed on C++ and so I’m not sure I’m using it “right” yet in terms of getting things parsed and such. Thanks!@

Editors FTW! :stuck_out_tongue:

Autocompletion in headers in c++ is a hard task, especially because the headers are headers, and they are not recognized by compile_commands.json that many clang-tools use.
But there is indeed IDE features that works good in editors, I would recommend you have a look to LanguageServerProtocols (LSP), in c++ there are two, cquery and clangd. I would recommend right now cquery, but don’t miss clangd in the future, which lives inside the codebase of the clang compiler :). Cquery creates an index/database, IDE style, and you can call it from whatever connector Atom or any other editor has for LSP’s.

By the way, I have a hacky fork of the linter in vim w0rp/ALE here, that provides linting in template headers providing a cpp file that uses that header, and the compile_commands.json that can be generated by cmake with the option: -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON.

1 Like