From nathan1hughes at gmail.com Mon Jan 29 18:56:26 2018 From: nathan1hughes at gmail.com (Nathan Hughes) Date: Mon, 29 Jan 2018 23:56:26 +0000 Subject: [Tomviz] Adding a file reader to Tomviz Message-ID: Hello, At the end of last year, our paper was published (https://plantmethods. biomedcentral.com/articles/10.1186/s13007-017-0229-8) and I used Tomviz for a lot of visual analysis. I'm currently in the process of moving a lot of my segmentation methods from MATLAB into Python and I would like to use Tomviz further. However we use a Scanco MicroCT scanner which produces a proprietary ISQ file format. I have written a file reader for it, both in Python and MATLAB, I could also rewrite it in C/C++ if needed and would like to add it to Tomviz as it would be extremely useful for my Institute to use for a lot of our projects, I also know others in my field who would appreciate this addition too. Would someone be able to advise on how I could go about making this addition to the Tomviz software? Obviously, I can navigate the code, I just want to do this correctly and in a way in which I can feed this back to other users on Github. Mostly I am unsure of which specific files are needed to be altered in order to accept another file type and how to point to the function to handle it. As you can see here: https://gist.github.com/SirSharpest/ fd0a039547eb4ca5f00b02de1216917f it's a straightforward process (this is just a quick example). Hope I can get some advise on this. Many thanks, -------------- next part -------------- An HTML attachment was scrubbed... URL: From cory.quammen at kitware.com Mon Jan 29 21:08:32 2018 From: cory.quammen at kitware.com (Cory Quammen) Date: Mon, 29 Jan 2018 21:08:32 -0500 Subject: [Tomviz] Adding a file reader to Tomviz In-Reply-To: References: Message-ID: Hi Nathan, It's great to hear you have been able to use Tomviz for your research. Thanks for sharing the link to your paper! It looks like you've done the hard work figuring out how to read the ISQ file format and even providing a reference implementation. At the moment we don't have infrastructure for loading a file from Python, but writing a reader for this format in C++ would be fairly straightforward. Tomviz currently includes a custom class vtkOMETiffReader, which is a reasonable reference for how to set up a reader for the ISQ format. It is somewhat complex in implementation, but the important bits are // Returns 1 if the reader can read the file with the given name, 0 if not. int CanReadFile(const char* fname) VTK_OVERRIDE; // Return a description of the file type. const char* GetDescriptiveName() VTK_OVERRIDE; // return a string with a space-separated list of file extensions const char* GetFileExtensions() VTK_OVERRIDE; // Set the size, or extent, or the image. void ExecuteInformation() VTK_OVERRIDE; // Actually reads and populates the dataset. void ExecuteDataWithInformation(vtkDataObject *out, vtkInformation *outInfo) VTK_OVERRIDE; Modify tomviz/pvextensions/CMakeLists.txt to add the reader source file to the list of sources to compile, and add the reader XML description to tomviz/pvextensions/tomvizExtensions.xml You'll also need to add your reader to the white list in tomviz/Behaviors.cxx and then add the reader instantiation in tomviz/LoadDataReaction.cxx It looks like a lot to do, but it really isn't too bad. Please let us know if you have follow up questions. Thanks, Cory On Mon, Jan 29, 2018 at 6:56 PM, Nathan Hughes wrote: > Hello, > > At the end of last year, our paper was published > (https://plantmethods.biomedcentral.com/articles/10.1186/s13007-017-0229-8) > and I used Tomviz for a lot of visual analysis. > > I'm currently in the process of moving a lot of my segmentation methods from > MATLAB into Python and I would like to use Tomviz further. However we use a > Scanco MicroCT scanner which produces a proprietary ISQ file format. I have > written a file reader for it, both in Python and MATLAB, I could also > rewrite it in C/C++ if needed and would like to add it to Tomviz as it would > be extremely useful for my Institute to use for a lot of our projects, I > also know others in my field who would appreciate this addition too. > > Would someone be able to advise on how I could go about making this addition > to the Tomviz software? Obviously, I can navigate the code, I just want to > do this correctly and in a way in which I can feed this back to other users > on Github. > > Mostly I am unsure of which specific files are needed to be altered in order > to accept another file type and how to point to the function to handle it. > > As you can see here: > https://gist.github.com/SirSharpest/fd0a039547eb4ca5f00b02de1216917f it's a > straightforward process (this is just a quick example). > > Hope I can get some advise on this. > > Many thanks, > > > _______________________________________________ > Tomviz mailing list > Tomviz at public.kitware.com > https://public.kitware.com/mailman/listinfo/tomviz > -- Cory Quammen Staff R&D Engineer Kitware, Inc. From marcus.hanwell at kitware.com Tue Jan 30 10:06:32 2018 From: marcus.hanwell at kitware.com (Marcus D. Hanwell) Date: Tue, 30 Jan 2018 10:06:32 -0500 Subject: [Tomviz] Adding a file reader to Tomviz In-Reply-To: References: Message-ID: On Mon, Jan 29, 2018 at 6:56 PM, Nathan Hughes wrote: > Hello, > > At the end of last year, our paper was published ( > https://plantmethods.biomedcentral.com/articles/10.1186/s13007-017-0229-8) > and I used Tomviz for a lot of visual analysis. > Great to hear about Tomviz being used in new areas! Thanks for the link, and for citing Tomviz. > > I'm currently in the process of moving a lot of my segmentation methods > from MATLAB into Python and I would like to use Tomviz further. However we > use a Scanco MicroCT scanner which produces a proprietary ISQ file format. > I have written a file reader for it, both in Python and MATLAB, I could > also rewrite it in C/C++ if needed and would like to add it to Tomviz as it > would be extremely useful for my Institute to use for a lot of our > projects, I also know others in my field who would appreciate this addition > too. > > Would someone be able to advise on how I could go about making this > addition to the Tomviz software? Obviously, I can navigate the code, I just > want to do this correctly and in a way in which I can feed this back to > other users on Github. > I don't have a definite timeline, but we are hoping to add the ability to use Python code to read and write data. This may be a good use case, as I have discussed file formats with a number of people it is clear that Tomviz would benefit from a simple method of adding new formats using Python scripts - there are one or two others on my RADAR with existing Python-based readers too. > > Mostly I am unsure of which specific files are needed to be altered in > order to accept another file type and how to point to the function to > handle it. > > As you can see here: https://gist.github.com/ > SirSharpest/fd0a039547eb4ca5f00b02de1216917f it's a > straightforward process (this is just a quick example). > > Hope I can get some advise on this. > As Cory pointed out the quickest method is to convert to C++, I hope to make this much easier in the next few months at least for cases where you have a simple 3D volumetric dataset. Hope that helps, and thanks for getting in touch! Best, Marcus -------------- next part -------------- An HTML attachment was scrubbed... URL: