JanaLipkova / GliomaSolver

Solver for simulating tumor growth and mass effect in patient brain anatomy
Other
23 stars 11 forks source link

Output in .dat Format #2

Closed andyxzhu closed 3 years ago

andyxzhu commented 3 years ago

Hi @JanaLipkova,

Thank you for the solver. In the documentation, I noticed it said "The GliomaSolver outputs data in two formats: .dat and .vtu."

However, when I tried the first example in the tutorial "Tumor Growth Modeling," I could not find an option to dump the output data as a .dat file. It only accepted a boolean vtk that determined if .vtu data was dumped.

Is there some way to make the solver yield a .dat file that has uniform resolution of the tumor density?

Thanks, Andy

JanaLipkova commented 3 years ago

Hi Andy,

thank you for the mail. And my apology for the late reply. I didn’t notice that my github account is linked with my former e-mail account.

To your question. You can save the tumor cell density at uniform grid using _dumpUQoutput() function (see https://github.com/JanaLipkova/GliomaSolver/blob/20fffcaaf816ad163d8499e116573ac03f57b165/Glioma/Glioma_ReactionDiffusion.cpp#L208 )

This function maps the tumor cell density into uniform grid (even when using adaptive part of the solver) and save it in the .dat format. To save the tumor cell density at the end of the simulation, you can just modify line 342 of the same file from:

if(bUQ) _dumpUQoutput();

to _dumpUQoutput();

But this will save only the final tumor state. If you want to save the data over time, same as the .vtu data dumper, you would need to modify the function _dumpUQoutput() such that it takes as input integer argument (e.g. number of iteration) and change the name of the output file from “HGG_data.dat” to a name including this unique integer (as not to overwrite the output each iteration). Then instead of calling _dump() you will call _dumpUQoutput( iteration_count)

Also, you can look at this file: https://github.com/JanaLipkova/GliomaSolver/blob/master/tools/DataProcessing/lib/Matlab2C/matrixMatlab2Cpp/matlab/loadMatrix.m which reads the .dat data from the solver into Matlab.

I hope it helped. If you have more questions let me know. Best regards, Jana Lipkova

azhu529 @.**@.>> Thu, 3 Jun, 15:51 (11 days ago) to JanaLipkova/GliomaSolver, JanaLipkova, Mention [https://mail.google.com/mail/u/0/images/cleardot.gif]

Hi @JanaLipkovahttps://github.com/JanaLipkova,

Thank you for the solver. In the documentation, I noticed it said "The GliomaSolver outputs data in two formats: .dat and .vtu."

However, when I tried the first example in the tutorial "Tumor Growth Modeling," I could not find an option to dump the output data as a .dat file. It only accepted a boolean vtk that determined if .vtu data was dumped.

Is there some way to make the solver yield a .dat file that has uniform resolution of the tumor density?

Thanks, Andy

Jana Lipkova

Pathology Department Harvard Medical School Brigham and Women's Hospital Lab: https://faisal.ai/

The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at http://www.massgeneralbrigham.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. Please note that this e-mail is not secure (encrypted). If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately. Continuing to send or respond to e-mail after receiving this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail.

andyxzhu commented 3 years ago

Hi @JanaLipkova,

Thank you very much for the response. The _dumpUQoutput() function seems perfect. However, would I have to re-compile the executable from the Makefiles? (I have been using the pre-compiled executables thusfar).

I followed the instructions (i.e. installing gcc, cloning the GliomaSolver repository and running the install file), but when I ran make -j 4, it showed that g++ was not found; after I installed g++, I received the following output and error messages.

out.txt error.txt

System Information: OS: Ubuntu 20.04.2 LTS gcc/g++ 9.3.0 CPU: Intel Core i7-6600U RAM: 16 gb

As for the code itself, yes I believe it's not difficult to modify. In the Glioma_ReactionDiffusion.cpp file below, I modified _dumpUQoutput to accept an integer counter (line 208), changed the file-naming scheme (line 264), added a line to increment the function (line 331), and changed line 343 to dump the final state.

Glioma_ReactionDiffusion.txt (sorry it's a .txt file, GitHub doesn't let me upload as a .cpp).

Do you have any guidance on running the Makefile? I managed to get a temporary workaround by setting UQ=1 and supplying my own TumorIC.txt and InputParameters.txt files, which dumped the final state as a .dat file, but I'd really like to get the tumor state at the other temporal values as well.

And thank you for bringing the loadMatrix.m file to my attention (I'm ultimately converting these .dat files to NumPy arrays, so this script is invaluable).

Best, Andy

JanaLipkova commented 3 years ago

Hi Andy,

my apology I didn't update my e-mail account and missed your question. If you still need help let me know and I'll try to reply in reasonable time. Eventually we can set up a call and solve your issue.

Best regards, Jana

On Sat, 19 Jun 2021 at 01:54, azhu529 @.***> wrote:

Hi @JanaLipkova https://github.com/JanaLipkova,

Thank you very much for the response. The _dumpUQoutput() function seems perfect. However, would I have to re-compile the executable from the Makefiles? (I have been using the pre-compiled executables thusfar).

I followed the instructions (i.e. installing gcc, cloning the GliomaSolver repository and running the install file), but when I ran make -j 4, it showed that g++ was not found; after I installed g++, I received the following output and error messages.

out.txt https://github.com/JanaLipkova/GliomaSolver/files/6680050/out.txt error.txt https://github.com/JanaLipkova/GliomaSolver/files/6680049/error.txt

System Information: OS: Ubuntu 20.04.2 LTS gcc/g++ 9.3.0 CPU: Intel Core i7-6600U RAM: 16 gb

As for the code itself, yes I believe it's not difficult to modify. In the Glioma_ReactionDiffusion.cpp file below, I modified _dumpUQoutput to accept an integer counter (line 208), changed the file-naming scheme (line 264), added a line to increment the function (line 331), and changed line 343 to dump the final state.

Glioma_ReactionDiffusion.txt https://github.com/JanaLipkova/GliomaSolver/files/6680083/Glioma_ReactionDiffusion.txt (sorry it's a .txt file, GitHub doesn't let me upload as a .cpp).

Do you have any guidance on running the Makefile? I managed to get a temporary workaround by setting UQ=1 and supplying my own TumorIC.txt and InputParameters.txt files, which dumped the final state as a .dat file, but I'd really like to get the tumor state at the other temporal values as well.

And thank you for bringing the loadMatrix.m file to my attention (I'm ultimately converting these .dat files to NumPy arrays, so this script is invaluable).

Best, Andy

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JanaLipkova/GliomaSolver/issues/2#issuecomment-864361023, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGWCUDTTWB5XYWMIUCYDFHDTTQWJPANCNFSM46BNBWMQ .