-
Notifications
You must be signed in to change notification settings - Fork 55
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
[RFC] style guide and performance guide #214
base: source
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it! Thanks so much.
are some justified reasons, it is a bad practice to write codes like `img .= img ./ 255` or | ||
`im2double(img)` variants. | ||
|
||
## Consistant usage of 0-1 range |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Consistant usage of 0-1 range | |
## Consistent usage of 0-1 range |
|
||
## Consistant usage of 0-1 range | ||
|
||
The rule of thumb in JuliaImages is that we consistantly treat all colors in a 0-1 range |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've noticed one exception: in ImageView, grayscale 16-bit images still generally have to dynamically scale the contrast. It's a bit frusturating but I don't know of a good workaround.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the only color types that can be considered normalized in the range [0,1] are AbstractRGB
and AbstractGray
. Considering other color types such as HSV
and Lab
, this sentence is somewhat misleading.
macros. Don't overuse macros only for convenient purposes. | ||
|
||
Specifically, MacroTools.jl and other macro packages that aims to provide extended syntaxes are | ||
delibrately not used; they are powerful but it makes the code a lot harder to understand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
various array types (e.g., `Array`, `OffsetArray`). There are more array types than you could have | ||
know. To make the codes more reliable and usable, it is recommended to code in a generic way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
various array types (e.g., `Array`, `OffsetArray`). There are more array types than you could have | |
know. To make the codes more reliable and usable, it is recommended to code in a generic way. | |
various array types (e.g., `Array`, `OffsetArray`). There are more array types than you can anticipate. | |
To make the codes more reliable and usable, it is recommended to code in a generic way. |
codes are written generally. With that check list passed, it's highly likely that your code works | ||
seamless with the JuliaImages ecosystem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codes are written generally. With that check list passed, it's highly likely that your code works | |
seamless with the JuliaImages ecosystem. | |
codes are written generally. With that check list passed, it's quite likely that your code will work | |
seamlessly with the JuliaImages ecosystem. |
## Keep small dependency | ||
|
||
Images.jl is an out-of-box solution for users of JuliaImages ecosystem. However, if you're | ||
developing image processing packages, you should instead depends on the more lightweight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
developing image processing packages, you should instead depends on the more lightweight | |
developing image processing packages, you should instead depend on the more lightweight |
Various functions have their own limitations, so by no means your function should pass all the | ||
checklist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Various functions have their own limitations, so by no means your function should pass all the | |
checklist. | |
We recommend several specific kinds of tests, although not all will be applicable in all cases: |
- axes agnostic check: `Array` and `OffsetArray`(e.g., `OffsetArray.centered(img)`) are good test | ||
candidates. | ||
- dimension agnostic check: make sure your function accepts `Vector`, `Matrix` and `Array{T, 3}` | ||
inputs. For some function, 0-dimensional array (e.g., `x=zeros(); x[]=1.0`) is also worth testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inputs. For some function, 0-dimensional array (e.g., `x=zeros(); x[]=1.0`) is also worth testing. | |
inputs. For some functions, 0-dimensional array (e.g., `x=zeros(); x[]=1.0`) is also worth testing. |
|
||
## API specification | ||
|
||
Because there are various algorithms to do one single task, we recommend the verb+noun+how API most |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because there are various algorithms to do one single task, we recommend the verb+noun+how API most | |
Because there are various algorithms to do one single task, we recommend the verb+noun+how API for most |
|
||
## If possible, implement the in-place version | ||
|
||
Many image processing algorithms admits a filter property: that it accepts an image (or series of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many image processing algorithms admits a filter property: that it accepts an image (or series of | |
Many image processing algorithms admit a filter property: that it accepts an image (or series of |
We need a style guide and performance guide for so long. This PR is currently a very very early draft and is far away from complete. It's not even readable but I figure I should open a PR to get some discussions and ideas.
This PR is expected to be a long run so I won't rush to merge it. I'll instead add and tweak the words when I have more ideas. Also feel free to directly modify this branch.
Some of the contents come from my maintenance experiences, and some come from other related issues:
exposure.jl
) Images.jl#772