Open AndreZeug opened 1 day ago
Any parameter you don’t specify in the function call gets the value described in the documentation.
If you want to ensure a function is called with specific parameters, or make it explicit in your code which parameters were used, specify each one explicitly, you don’t need to depend on defaults.
Adding an option to each function to output its default parameters would be way too much work, and wouldn’t add very much value over the documentation.
Regarding the truncation
parameter: In the case of the FIR filter, the 1D Gaussian kernel gets a size given by 2 * ceil(truncation * sigma) + 1
. Multi-dimensional Gaussian kernels are composed by convolving 1D kernels (it’s a separable filter). For derivative kernels the size is a bit larger. This is described in the online documentation: https://diplib.org/diplib-docs/linear.html#dip-GaussFIR-Image-CL-Image-L-FloatArray--UnsignedArray--StringArray-CL-dfloat- — I don’t know how much of this made it to the documentation in MATLAB… but that documentation should name the DIPlib function(s) being called, so you should always be able to read the more complete online documentation. Please let us know if information is missing from the documentation!
Regarding the padding: The image gets padded by half the kernel size on each side (i.e. by ceil(truncation * sigma)
). So if you have an image dimension of size 128, and your sigma is 600, that image dimension will be padded to 3728 pixels (if I did the math correctly in my head). You are better off just computing the average intensity across that dimension instead of blurring, the result should be more or less the same, but the computation much cheaper. There is no logic in the code to avoid you shooting yourself in the foot.
Dear Cris, thank you very much for your explanation.
I completely understand that adding an extra output to each function would be tedious.
Yes, I should be aware of your detailed documentation. Unfortunately in MATLAB the doc and help only provide the first commented lines of the corresponding m-file. Interestingly, the 'section' below % SEE ALSO:
is translated directly as a hyperlink.
When I add
% SEE ALSO:
% derivative
% https://diplib.org/diplib-docs/linear.html#dip-GaussFT-Image-CL-Image-L-FloatArray--UnsignedArray--dfloat--String-CL-String-CL-StringArray-CL
The online help could be accessed in both cases by clicking on the link help gaussf
and doc gaussf
.
Since the online doc does not have a one-to-one translation for each of the 400 DIPimage m-files, it would still be a lot of work to add a specific link.
But, alternatively, it might be possible to add the general link, e.g,
...
%
% SEE ALSO:
% derivative
%
% FURTHER READING:
% https://diplib.org/diplib-docs/modules.html
%
% DIPlib:
...
to each of the m-files. Maybe this can be done automatically by a small 'auto-replace' programme? This might help 'leaky brain' users like me. 🙈
How can I find out which (default) parameters have been used by a function? For example, when using
image_out = gaussf( image_in, 200, 'best');
how can I find out whichmethod
,boundary_condition
andtruncation
was used? Yes, to some extent this is described in the documentation, but certainly it does not cover all real world scenarios. Probably, in the example above it does not usetruncation = 3
but maybe 3x sigma, or, if image_in is inhomogeneous in dimension e.g. 128x128x3000, it is not necessary to extend the kernel to 600 in xy.Component DIPlib