Skip to content
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

Adding support of Center-X/Y/Z for VolReader/Writer #879

Merged
merged 12 commits into from
Jul 13, 2014

Conversation

jlevallois
Copy link
Member

Overview

Actually, VolReader & VolWriter don't care about Center-X params set in vol files.
It can be problematic if you write a .vol from a centered object and read it after: a shift appears

Before Writing: [HyperRectDomain] = [[PointVector] {-20, -20, -20}]x[[PointVector] {20, 20, 20}]
After Reading: [HyperRectDomain] = [[PointVector] {0, 0, 0}]x[[PointVector] {40, 40, 40}]

In this PR, Center-X/Y/Z params are parsed if they are into the vol file and took into consideration.:

Before Writing: [HyperRectDomain] = [[PointVector] {-20, -20, -20}]x[[PointVector] {20, 20, 20}]
After Reading: [HyperRectDomain] = [[PointVector] {-20, -20, -20}]x[[PointVector] {20, 20, 20}]

If no Center-X/Y/Z params are into the vol file, the previous behavior is used:

[HyperRectDomain] = [[PointVector] {0, 0, 0}]x[[PointVector] {40, 40, 40}]

Same for LongvolReader & LongvolWriter

Minor changes

VolReader.getHeaderValueAsInt() returns always a value greater than zero (aka failure). This bug is fixed (also in LongvolReader.getHeaderValueAsInt()).

@jlevallois
Copy link
Member Author

One test fail with this PR : testSliceImageFromFunctor. I've look at it but don't know exactly where is the issue. Any idea @kerautret ?

It seems when PGMWriter::exportPGM is called, it check the value for [PointVector] {20, -20, 19} when the domain is only [HyperRectDomain] = [[PointVector] {-20, -20, -20}]x[[PointVector] {19, 19, 19}]

@jlevallois
Copy link
Member Author

Ok, got it!
The 20 value passed in Projector constructor is the coordinate of center of object. Since cat10.vol has Center-X/Y/Z params to 0, the (new) center isn't longer {20,20,20} but {0,0,0}.

So this PR is ready to be reviewed 😎

@dcoeurjo
Copy link
Member

would you have a small test (write/read a vol with translated domains and making sure that domains are identical) ?
Otherwise, nice PR

@jlevallois
Copy link
Member Author

Test added ( testVolReader ):
Before this PR :

New Block [Testing VolWriter ...]
[HyperRectDomain] = [[PointVector] {-17, -14, -13}]x[[PointVector] {5, 7, 11}]
EndBlock [Testing VolWriter ...]
New Block [Testing VolReader ...]
[HyperRectDomain] = [[PointVector] {0, 0, 0}]x[[PointVector] {22, 21, 24}]
EndBlock [Testing VolReader ...]
Failed.

After :

New Block [Testing VolWriter ...]
[HyperRectDomain] = [[PointVector] {-17, -14, -13}]x[[PointVector] {5, 7, 11}]
EndBlock [Testing VolWriter ...]
New Block [Testing VolReader ...]
[HyperRectDomain] = [[PointVector] {-17, -14, -13}]x[[PointVector] {5, 7, 11}]
EndBlock [Testing VolReader ...]
Passed.

@dcoeurjo
Copy link
Member

nice.. could you please check the travis error ?

@jlevallois
Copy link
Member Author

My bad, an unexpected ctrl+x has been there.

@dcoeurjo
Copy link
Member

Thanks..

dcoeurjo added a commit that referenced this pull request Jul 13, 2014
Adding support of Center-X/Y/Z for VolReader/Writer
@dcoeurjo dcoeurjo merged commit 3952748 into DGtal-team:master Jul 13, 2014
@jlevallois jlevallois deleted the AddingCenterSupportForVolWriter branch July 15, 2014 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants