How to specify the output file format of "Sequences of files"
ZenanH opened this issue Β· 6 comments
Hi! I'm using splashsurf in my project, it is very great!π
In my case, I need the surface format in .obj
instead of the default .vtk
. I can specify the output format by -o filename.obj
for single file, however it cannot work when I use the "sequences of files", here is my code: (it still generates files in .vtk
format)
splashsurf reconstruct -s "model_{}.ply" --output-dir=out -o "test_{}.obj" --mt-files=on --mt-particles=off --particle-radius=0.00187 --smoothing-length=1.2 --cube-size=0.5 --surface-threshold=0.6
For now, I wrote a for-loop in .bat
file, it worked with a bad efficiency. So, I'm wondering how to generate .obj
directly?
I checked the code and at the moment the sequence processing feature only supports outputting VTK files. Next week I can look into updating the code to support all of the output formats.
Usually the batch script should not be slower than the sequence processing in splashsurf, except if you have only very few particles which would make it faster to process multiple files in parallel instead of processing particles inside of one file in parallel.
If this is the case, for now you could consider using Python to start multiple processes in parallel using multiprocessing
: https://stackoverflow.com/questions/46542957/how-to-run-an-external-program-in-parallel-mode-using-python3
However, in this case you should disable parallel processing for splashsurf itself with the command line option --mt-particles=off
@ZenanH I just published a new release (v0.9.0) which allows you to directly output .obj files from a sequence. If you use --input-sequence=file_{}.vtk
, just specify additionally e.g. --output-file=file_surface_{}.obj
and it should work.
You can install the latest version of splashsurf normally using cargo install splashsurf
.
Great!π
I just tested the code, however, I got an error because splashsurf
cannot find the input files.
Here is my command:
pwsh> splashsurf reconstruct -s "model_{}.ply" --output-dir=out -o "blender_{}.obj" --particle-radius=0.00187 --smoothing-length=1.2 --cube-size=0.5 --surface-threshold=0.6 --mt-files=on --mt-particles=off
[2023-04-19T11:52:01.187023+02:00][splashsurf][INFO] splashsurf v0.9.0 (splashsurf)
[2023-04-19T11:52:01.187682+02:00][splashsurf][INFO] Called with command line: C:\Users\zenan\.cargo\bin\splashsurf.exe reconstruct -s model_{}.ply --output-dir=out -o blender_{}.obj --particle-radius=0.00187 --smoothing-length=1.2 --cube-size=0.5 --surface-threshold=0.6 --mt-files=on --mt-particles=off
[2023-04-19T11:52:01.188365+02:00][splashsurf::reconstruction::arguments][INFO] Found 0 input files matching the pattern "model_(\d+)\.ply"
[2023-04-19T11:52:01.189118+02:00][splashsurf::reconstruction][INFO] Successfully finished processing all inputs.
[2023-04-19T11:52:01.189268+02:00][splashsurf][INFO] Timings:
And here is my dir:
pwsh> ls
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 4/19/2023 11:38 AM out
-a---- 3/7/2023 5:11 PM 9551015197 3d_collapse.h5
-a---- 4/19/2023 12:10 AM 1633805 3d_collapse.vtu
-a---- 4/19/2023 11:36 AM 13824111 model_1.ply
-a---- 4/19/2023 11:36 AM 16316826 model_10.ply
-a---- 4/19/2023 11:36 AM 16056831 model_2.ply
-a---- 4/19/2023 11:36 AM 16295608 model_3.ply
-a---- 4/19/2023 11:36 AM 16300976 model_4.ply
-a---- 4/19/2023 11:36 AM 16298754 model_5.ply
-a---- 4/19/2023 11:36 AM 16309847 model_6.ply
-a---- 4/19/2023 11:36 AM 16307812 model_7.ply
-a---- 4/19/2023 11:36 AM 16313365 model_8.ply
-a---- 4/19/2023 11:36 AM 16313661 model_9.ply
Is this because there is a problem with my input file name?
(it works well for the single file)
Thanks for testing this. There appears to be a bug in the code that tries to find the files belonging to the sequence if there is no path in front of the filename. I will fix it.
For now it should work if you specify either the full path or a relative path in front of the filename, like -s ".\model_{}.ply"
.
@ZenanH I just published version 0.9.1 which should fix this problem.
It worksπ, thanks~