-
Notifications
You must be signed in to change notification settings - Fork 27
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
Generate a variety of testing data and came up command_line version of sim_vim_sig.py #51
Conversation
Yes, I think it should just be one script, just changes to the original The change to |
A clear and concise description of what you want to happen Various test files based on the multiple value of b_value in the b_values.py Also, the generic_0.json was supposed to be the same thing as generic.json as I used the placeholder bvalue for it. But, the result is not the same. I guess the generic.json was generate from another b_value different from the current one. (I did not make any change to generic.json.) There might also be a need for me to explain the changes made through a call or recording @etpeterson I will update the pr based on your feeedback and also come up with a documentation for running the scipt. Link this PR to an issue [optional] 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.
Getting there. Several specific comments and it looks like one of the json files isn't correctly generated.
@@ -103,7 +105,7 @@ def contrast_curve_calc(): | |||
D[36] = 3e-3 # 36 artery | |||
D[37] = 3e-3 # 37 vein | |||
D[40] = 1.31e-3 # 40 asc lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926 | |||
D[41] = 1.31e-3 # 41 trans lower intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926 | |||
D[41] = 1.31e-3 # 41 trans lower# If conversion fails, try splitting the input as a lis intestine : Hai-Jing et al. doi: 10.1097/RCT.0000000000000926 |
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.
Probably accidental add?
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.
Yeah, it is accidental. Will correct it.
parser.add_argument("-b", "--bvalue", type=float, | ||
nargs="+", | ||
help="B values (list of of numbers)") | ||
parser.add_argument("-bf", "--bvalues-file", metavar="FILE", type=parse_bvalues_file, |
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.
Maybe just -f
for the short?
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.
Yeah, noted. Will make changes to it.
@@ -0,0 +1,7 @@ | |||
[ | |||
[0.0, 1.0, 2.0, 5.0, 10.0, 20.0, 30.0, 50.0, 75.0, 100.0, 150.0, 250.0, 350.0, 400.0, 550.0, 700.0, 850.0, 1000.0], |
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.
Rather than a list of lists perhaps an object so they can have names rather than just numbers?
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 tried object for the naming, but, we will have to enforce a pattern of naming on any one running the command for easy parsing.
Something like { generic_ : [], ...}. That is why I made it into a list of list. But, if you think object is better approach then I can change it to that.
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'd prefer objects. That way we have meaningful file names, like generic_short.json.
Some naming system would be good. I'm not sure what you mean "for easy parsing". I would imagine that people give either no name and they get all out or they give a name and they get that one out.
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.
This is still pending as well.
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.
Ok, I will change it to object.
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 don't understand your comment that the file changed. It looks like just a newline to me, am I wrong?
Along those lines, whichever file is a duplicate of this should be deduplicated. Your changes shouldn't alter the original bvalues in any 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.
The generic.json does not change. What I am saying is that, when I was trying to regenerate the generic.json using the current bvalues. I got different json values. So, that is why I said the generic.json might be generated from another bvalues different from the placeholders.
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.
There shouldn't be changes to generic.json. I commented elsewhere on that. If it also changed in the main branch then perhaps, but I would be very surprised if that were the case.
Assuming there aren't changes though, we don't need two copies of generic.json. So confirming a duplicate and remove the original generic.json
and point everything to the new one.
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.
This is still pending.
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.
Ohh, I will take care of that.
else: | ||
output_file = 'output_resp.nii.gz' # Replace with your desired output file name | ||
bvalues = [[0., 1, 2, 5, 10, 20, 30, 50, 75, 100, 150, 250, 350, 400, 550, 700, 850, 1000]] |
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.
It seems odd to have a double array, why is this?
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 had to make it a double array so that I can have one implementation with when the value is gotten from the files. Check line 420.
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.
Oh I see. I guess it'll change with an object implementation anyway.
}, | ||
"config": { | ||
"bvalues": [ | ||
43.0, |
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.
Something isn't right with these bvalues.
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.
Ohh, that is true, I will change it. Those values I gave while testing the script in the command line.
@etpeterson Kindly go through the comment, then I can make the necessary changes. Thank you. |
I changed the generic_0.json. Also correct the mistake in the script. Also changed the -bf option flag to -f flag. What I was saying regarding the generic.json is that, the value in generic_0.json was supposed to be the same thing with the generic.json. Because, the bvalue for generic_0.json was the one bvalue in the repo. My suggestion is that, the bvalue used to generate generic.json is different from the one present in the repo. |
Is this still different? We can see the bvalues used for generic.json in the file itself. And I can see they are the same as the default set you're using. Is it different on the main branch too? I would be surprised if it's different on the main branch so that would be a good place to check. |
@etpeterson , I ran it on the unchaged main branch and it still give the different result from the generic.json. Yeah, the bvalues used is the same, something is wrong somewhere I guess. |
That is surprising. What's the difference? |
This is strange. I don't know why that would change. The history doesn't show meaningful changes to that file. I'll give it a shot. Also, unfortunately you have a merge conflict. |
I'm not sure what to say, but it worked for me, I got the same data in both. Here are my steps.
|
Did you move the utitlities to the |
No, if the pythonpath is set correctly it finds them where they are. Even if you pull the images manually I think the result should be the same though. |
Yeah, I was able to get the same data. But, do we want to add https://github.com/OSIPI/TF2.4_IVIM-MRI_CodeCollection/blob/main/phantoms/MR_XCAT_qMRI/sim_ivim_sig.py#L13 to the script. This keeps downloading all the data everytime. |
If that's the case then it sounds like a good issue to be fixed in a different pull request. |
I'll try to actually run it later and test that, but the code looks good to me at the moment. Just a few changes still pending. |
What was the problem? Is it something that we can fix with some instructions or code? |
I think, if possible, we should have the downloading of data separately. Then, in the documentation for running the code that I will be providing, I will mention it there. |
I really think it is some mix up somewhere, probably I deleted or add some code mistakenly. I resolved the problem by rewriting the code from the start. |
We shouldn't try to reimplement git-lfs here, but also a simple check to see if the requisite files are present and if not then download seems pretty easy. If it's in the document and in the code then requiring two steps is fine. |
A clear and concise description of what you want to happen
Added this two files.
sim_ivim_sig_command_line.py - This is the command line version of the sim_vim_sig,py
sim_ivim_sig_mul_bval.py - This version is used for running multiple b_value which are stored in b_values.py
Various test files based on the multiple value of b_value in the b_values.py
├── generic_five.json
├── generic_four.json
├── generic_original.json
├── generic_three.json
├── generic_two.json
Also, the generic_original.json was supposed to be the same thing as generic.json. But, the result is not the same. I guess the generic.json was generate from another b_value different from the current one.
Also, @etpeterson what do you think about combining the three scripts(sim_ivim_sig_command_line.py, sim_ivim_sig_mul_bval.py, sim_ivim_sig.py) together instead of having multiple scirpts doing almost similar thing ? What we can do is to just have a single script that can be used as command line tools and is able to generate multiple value of test data based on the multiple b_values.
I will update the pr based on your feeedback and also come up with a documentation for running the scipt.
Link this PR to an issue [optional]
Fixes #41
Checklist