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

Data are transposed if passed as python dicts #15

Closed
paskino opened this issue Mar 15, 2018 · 3 comments
Closed

Data are transposed if passed as python dicts #15

paskino opened this issue Mar 15, 2018 · 3 comments
Assignees

Comments

@paskino
Copy link
Collaborator

paskino commented Mar 15, 2018

in branch typecheck, passing model/object parameters as python dicts results in a transposition of the model/object.
running https://github.com/dkazanc/TomoPhantom/blob/typecheck/python/Demos/DemoModel2.py
image

instead of https://github.com/dkazanc/TomoPhantom/blob/typecheck/python/Demos/DemoModel.py
image

@paskino
Copy link
Collaborator Author

paskino commented Mar 15, 2018

I did some more investigation. I put a couple of printf's in the TomoP2D_core.c. On line 52 and 238.
I use model = 6 which is a single rectangle:

Object : rectangle 1.00 -0.15 0.2 0.4 0.3 45;

Now, if I use this code

model = 6
N_size = 512
#specify a full path to the parameters file
pathTP = '../../functions/models/Phantom2DLibrary.dat'
#This will generate a N_size x N_size phantom (2D)
phantom_2D = TomoP2D.Model(model, N_size, pathTP)

We get this output:

C0 1.00e+00 x0 -1.50e-01 y0 2.00e-01 a 4.00e-01 b 3.00e-01 phi 4.50e+01
Base C0 1.00e+00 x0 2.00e-01 y0 -1.50e-01 a 4.00e-01 b 3.00e-01 phi 4.50e+01

It means that the call at line 238 gets the parameters in the order we are expecting, while the code at line 52 has the x0 -> y0 swapped.

This code I was developing extracts these parmeters

[{'C0': 1.0, 'y0': 0.2, 'phi': 45.0, 'x0': -0.15, 'a': 0.4, 'b': 0.3, 'Obj': <Objects2D.RECTANGLE: 'rectangle'>}]
Base C0 1.00e+00 x0 -1.50e-01 y0 2.00e-01 a 4.00e-01 b 3.00e-01 phi 4.50e+01

So x0 and y0 are exactly as in the parameter file.

@paskino
Copy link
Collaborator Author

paskino commented Mar 15, 2018

Now, I've done a wild guess and swapped x0 and y0 here and now the DemoModel2.py works fine.
Please check if that's correct.

@dkazanc
Copy link
Owner

dkazanc commented Apr 1, 2018

a new capability of creating new object is added, issues have been fixed including the current one

@dkazanc dkazanc closed this as completed Apr 1, 2018
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

No branches or pull requests

2 participants