jilei-hao / hubmap-penntmc-modeling Goto Github PK
View Code? Open in Web Editor NEWThis project forked from apouch/hubmap-penntmc-modeling
This project forked from apouch/hubmap-penntmc-modeling
The ultimate goal for name displaying is to display section name in the frontend viewer. This requires name data to be generated and mapped to the section labels. We now have each label mesh stored separately. We need to add label name to the each corresponding label mesh.
Read the label file into the generator. And create a map between label id and name. Add name as field data to the corresponding label mesh.
The HuBMAP ovary model generator creates ovary models to be rendered by the web UI, based on user input parameters. To help UI users have a better sense of the location and orientation of the ovary, we want to add a pelvis model to the render scene as a reference.
Change the appearance of the pelvis model so it looks like a background structure.
Modify the polydata mapper to adjust the appearance of the pelvis model. Give the model a neutral color like white or grey, and adjust the transparency to make it looks like a background.
An important proposed feature of the HuBMAP Web UI is displaying section names. User should be able to get the section name by pointing to a section (getting name by section), and has the section highlighted when pointing to the name of the section (getting section by name).
Now we have a scene with disassembled sections, we need to export the scene to JSON format
Use the vtkJSONSceneExporter to export the content in the vtkRenderWindow to a JSON file.
Add a input check for generator. Specifically:
nslices can only be: 1, 3, 12
nrot can only be: 1, 2, 4
Currently hubmap-model only has one generator. We need to change it to generate multiple types of models, such as 3d mold, uterus, etc. in addition to the ovary model.
For this task, we are focusing on modularizing the ovary generating logic. Create a "OvaryModelGenerator" class to make following code snippet work in the main function.
#include "OvaryModelGenerator.h"
int main () {
OvaryModelGenerator *ovaryGen = new OvaryModelGenerator();
ovaryGen->SetRotationalSlices(nrot);
ovaryGen->SetLongAxisSlices(nslice);
ovaryGen->SetDimensions(d, h, w);
ovaryGen->IncludePelvis(true);
ovaryGen->Generate();
vector<vtkSmartPointer<vtkPolyData>> meshes = ovaryGen->GetOutput();
/*
Exporting logic
*/
delete ovaryGen;
return 0;
}
The future versions of this generator should be able to generate models more than just ovary models. Instead of putting everything into the main function separated by conditionals, we want a modularized logic to achieve maximum flexibility. Specialized logic should be wrapped in separate classes with a VTK-like interface for user to configure and use.
We can assume the Ovary position does not change after generated by original code.
Make following example code snippet work
#include "PelvisModelGenerator.h"
int main () {
...
// context code
vtkSmartPointer<vtkPolyData>ovary = OvaryModelGenerator->GetOutput();
const float pelvisIntercristalDistancemm = 290;
// target user code
PelvisModelGenerator *pvsGen = new PelvisModelGenerator();
pvsGen->SetIntercristalDistancemm(290);
pvsGen->SetPositionForPatientLeftOvary(ovary);
pvsGen->SetPositionForPatientRightOvary(ovary); // optional
pvsGen->Generate();
vtkSmartPointer<vtkPolyData>pelvis = pvsGen->GetOutput();
/*
Exporting logic
*/
delete pvsGen;
return 0;
}
An important proposed feature of the HuBMAP Web UI is displaying section names. User should be able to get the section name by pointing to a section (getting name by section), and has the section highlighted when pointing to the name of the section (getting section by name).
To implement the name displaying feature, the generator has to be modified to generate models in a disassembled format. Currently after extracting level-set models, the generator merges them together into one mesh file. For this task, generator needs to be changed to keep the models in disassembled format, and be added into a vtkRenderWindow, which can then be used to be exported as a JSON scene. The JSON scene then can be used by the web component for the name displaying.
Remove the assembling logic that assembles the ovary model sections and add the sections to a vtkRenderWindow.
The HuBMAP ovary model generator creates ovary models to be rendered by the web UI, based on user input parameters. To help UI users have a better sense of the location and orientation of the ovary, we want to add a pelvis model to the render scene as a reference.
The imported pelvis model needs to be transformed to the correct location relative to the ovary model.
Use the vtk transformation filter to translate/rotate the pelvis model to move it to the the correct location related to the ovary model.
The term "correct" for this task is based on the standard of human eyes. We don't need extremely precise location since this is just a visual reference. Compare the result to the example page given in the resource section. We can accept the result when the relative locations of ovary and pelvis look similar to what's in the example.
Example Ovary-Pelvis location: https://training.seer.cancer.gov/ovarian/intro/
Exported JSON folder needs to be compressed to zip to be read by the web component. Modify the generator to compress the generated JSON scene folder into one .zip file
The HuBMAP ovary model generator creates ovary models to be rendered by the web UI, based on user input parameters. To help UI users have a better sense of the location and orientation of the ovary, we want to add a pelvis model to the render scene as a reference.
Import the model into the ovary model generator. The imported format should be able to be added to the render scene of the generator, together with the ovary model.
Download the pelvis data from here, and write code to read the model and add output polydata to the scene.
Merge the release v1.1.0 branch into pelvis dev branch and make the pelvis code work with the latest json scene exporting logic.
Currently the generator is reading the pelvis file into the scene by using a hard-coded path. To make this program portable, we need to integrate the pelvis model file into the project.
Create a data folder in the project source directory. Copy the pelvis data to the data folder and commit the change to the source control. In the CmakeLists.txt, write code to copy the data file to the binary folder, so the program can use relative path to retrieve the data file.
CMake Copy file: https://stackoverflow.com/questions/34799916/copy-file-from-source-directory-to-binary-directory-using-cmake
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.