no images found during conversion to .nc
Opened this issue · 7 comments
I used AVIZO software to convert a series of tiff slices to pgm. However, the ./bin/pgmtonc code keeps terminating with the following warning after i tried to run it using one pgm slice and a pgm file created by catenating the pgm slices:
terminate called after throwing an instance of 'std::runtime_error'
what(): no images found
Aborted
I would be grateful for any help with this problem.
Hi - sorry for the delayed response to your query. I guess you were able to resolve this yourself? I'm not familiar with AVIZO, but if you would like to post your solution that would help anyone else that encounters the same problem.
Yes, I solved it by concatenating the .pgm files obtained from Avizo along their headers, creating one .pgm file which was converted to .nc outputs using the pgmtonc code. The outputs were then concatenated along the Z direction to obtain one .nc file to be processed with the SEDT code and persistence.py. I am now having issues with the latter for python3.9 (e.g., the "from morse" line in the persistence code is not working). I would also like to know if the concatenation process will anyway affect the persistent analysis output.
Thanks.
I'm glad you solved the input file issues.
The python code is very out of date sorry. After I've finished teaching this semester I plan to look at updating it properly. The import line "from MorseAnalysis import VolumeImage, VectorField" is probably failing due to a linking or path definition problem. This will be machine and OS dependent. Generally, I get around this by processing the data files directly using the C++ executables. (This is described in the README file). Then in the python code persistence.py you can comment out the "from MorseAnalysis ..." line and the function "fromVolumeFile(filename, options):" (lines 10--23) and anywhere else that calls it. The persistence.py code then has scripts to read in a persistence*_PP.txt file and do some basic manipulation of that data.
The concatenation process shouldn't change the SEDT and persistence analysis. The only problem you might encounter is if the Z-spacing of the slices is different to the X- and Y- pixel resolution. The SEDT code assumes the voxels are in an equal-edge-length cubic grid.
Sorry for replying late (I have been busy with data collation). Please what did you mean by the "C++ executables"? Do you mean compiling MorseAnalysis.pyx into an application extension? I just did that, and I'm lost on the next step. Thanks so much for offering to update the code. I look forward to using it to process my collated data.
I updated the README document in my fork, but it hasn't been pushed through to the main branch yet. You can see it here: https://github.com/robinsv/diamorse
By "C++ executable" I mean programs you run from the command-line in a terminal window. These are in the directory diamorse/bin/. The programs needed to get the persistent homology data are called "VectorField" "Simplify" and "PersistencePairs". Usage is described in the (robinsv) README file. Once you have the text file with the persistence pairs you can read that in with python scripts and process and plot as you wish.
I have tried to use the PersistencePairs module without any luck (it gives me a zero output everytime). I believe it is because I did not specify the persistence limit, size limit, and threshold values when using the Simplify module. Min and max values obtained after using the SEDT module were negative and ranged between 7 to over 1 billion after using the Morsefield module.
Considering I am trying to process micro-CT data obtained at a resolution of X microns, how can I calculate the values (persistence limit, size limit, and threshold) used to Simplify the output of the Morsefield module and obtain an output from the PersistencePairs module?
If all values in the SEDT are negative then it seems something went wrong at that step. The input to SEDT should be a *.nc file with voxel values taking either 0 or 1. The output then replaces the '1' voxels with their +ve distance to the boundary and the '0' voxels with -ve distances to boundary. Voxels that are adjacent to the opposite type are given a distance of +/- 0.5. So if your input to SEDT was a binary image your output should have values of both sign.