-
Notifications
You must be signed in to change notification settings - Fork 28
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
SinoGeom #68
SinoGeom #68
Conversation
Codecov Report
@@ Coverage Diff @@
## master #68 +/- ##
==========================================
- Coverage 99.76% 99.76% -0.01%
==========================================
Files 48 49 +1
Lines 2121 2117 -4
==========================================
- Hits 2116 2112 -4
Misses 5 5
Continue to review full report at Codecov.
|
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.
Nice!
I noticed that all related data are stored in SinoGeom
, which is good. One possible caveat of this is that probably not all methods(SinoMoj
, SinoPar
, and SinoFan
) have the same data fields, and when this happens, some additional checks are needed.
I believe it would be better to organize types in the following way:
abstract type SinoGeom end
"`SinoPar()` parallel-beam geometry"
struct SinoPar <: SinoGeom
SinoPar_arg1
SinoPar_arg2
end
struct SinoMoj <: SinoGeom
SinoMoj_arg1
SinoMoj_arg2
end
function downsample(sg::T, down::Int) where T <: SinoGeom
T(...)
end
There might be some code redundancy here, but I feel that makes code decoupled in a meaningful and extensible way.
I don't know any detailed meaning of the codes, so this is just some rough suggestion and it could be inappropriate in your case.
Thanks. I had a similar thought but was concerned about the possible code redundancy. |
function downsample(sg::SinoMoj, down::Int) | ||
down == 1 && return sg | ||
return SinoMoj(_downsample(sg, down)...) | ||
end |
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.
Just some nichpicking comment 😄
function downsample(sg::T, down::Int) where T<:Union{SinoPar, SinoMoj}
down == 1 ? return sg : T(_downsample(sg, down)...)
end
and similar to sino_geom_over
Yes, sometimes, code redundancy in the most fundamental layer makes it easier to write orthogonal codes at a higher-level and makes it easy to add new things. sometimes it's just a matter of preference.
Is there anything I can do before JeffFessler/mirt-demo#1 is fixed? |
Move towards dispatch version of sinogram geometry types.