kitchell / app-decimatemesh

This application will reduce the number of vertices and faces on 3D surfaces by the percent reduction chosen. It can also be used to convert between filetypes.
0 stars 2 forks source link

3Dsurfaces datatype #2

Open soichih opened 4 years ago

soichih commented 4 years ago

@kitchell

I am looking into the 3Dsurfaces datatype (https://brainlife.io/datatypes/59307a08436ee50ffd973278) and see if we can use this to output pRF surface. Although most 3Dsurfaces dataobjects are stored in .vtk, according to freesurfer>3dsurface conversion app (https://brainlife.io/app/5b083f9341711001e958b2b7) The actual file format can be one of the following

(I think the first 3 can be converted between each other using mris_convert command, but I am not sure how to go between gii<>mgz. But that's another story..)

The issue with 3Dsurfaces having different format is that, All apps that use this datatype as input must handle all those filetypes. For example, this app (app-decimatemesh) only handles.

I am wondering if we can narrow down the file formats that this datatype could store (pick the most generic/superset file format.. I am not sure which one..) so that we can use this datatype for pRF.

kitchell commented 4 years ago

The freesurfer one is the only one that is not only vtk, ply, or stl. Im fairly certain all other apps that I have created that use the 3d surfaces can handle all 3 datatypes, though the LB spectrum apps might just be vtk.

Users should choose vtk if they want to process the surfaces using other bl apps, but they have the choice to choose the other options if they plan to download the surfaces from brainlife and use them in other applications. Vtk is not well supported in 3D modeling/viewer software, but it is well supported in python. ply and stl can be viewed in all 3d modeling/viewer software but vtk is easier to work with in python. stl is the format used for 3d printing. There are good reasons to have all 3 options.

This app can be used to convert between all 3. Perhaps just create an additional app that converts gii, mgz and add a datatype tag to indicate which format has been chosen.

kitchell commented 4 years ago

What format does pRF use?

soichih commented 4 years ago

pRF outputs in .gii. (and .nii.gz for volume output). It also generates reduced resolution surface in .vtk for vis purpose.

I think it would be best if 3dsurfaces datatype only supported .vtk so that other Apps only needs to worry about vtk format. We can write an App that converts 3dsuface (vtk) to other formats like .stl, .ply, even other file formats (similar to how most app uses .tck but we can convert it to .trk at the end of processing if they need it) I really don't want our new Apps to support all those other file formats.

Also, is it correct to understand that 3dsurface datatype more/less exists for visualization / 3d-printing purpose? On the contrary, the .gii from pRF is not really for visualization but for further data analysis / processing. pRF apps actually output .vtk also but they are only used for visualization (reduced resolution).

So, to recap, I see the right course of action is to redefined 3dsurfaces to only support vtk - and make this datatype used for mainly for vis purpose, and pRF app to store the vis .vtk. We will probably need to register a new datatype for .gii for other data analysis.

Another approach might be to redefine 3dsurface to use .gii - then we can really just use 3dsurface to store data analysis output from pRF - but that will mean we will need to update all existing App that currently use 3Dsurfaces. Actually, you mentioned most app already handles .gii? Do you think this approach is possible?

kitchell commented 4 years ago

3D surfaces should NOT be .gii. most apps do NOT handle .gii.

.gii should be a different datatype. It is a more specialized filetype, I think one just for neuroimaging? I think it comes from freesurfer?

The 3dsurface dataype has many purposes. It is not just for visualization/3d printing purposes at all. the surfaces are used for data analysis with the LB spectrum apps. They could also be used for many other data analyses.

The 3dsurfaces datatype should represent any data that is a 3d triangular mesh. Those triangular meshes ideally should be readable by 3D modeling or 3D viewing software (e.g. Meshlab, Blender). Unfortunately, there exists many, many filetypes for 3d triangular meshes (e.g. https://all3dp.com/3d-file-format-3d-files-3d-printer-3d-cad-vrml-stl-obj/).

.vtk is a filetype from the Visualization Toolkit (https://vtk.org/) and it is used with python and similar, mostly in coding and computer graphics situations, but it is not used by 3d modeling software (e.g. Meshlab and Blender do not read it I think). I think .vtk can save color information. .vtk is also not only for triangular meshes, it can hold many types of data.

.stl is used for 3d printing, but it can be used for any purpose that requires a 3d surface. It does not have any color information, just vertices and faces.

.ply is used for many 3d modeling purposes. It does save color information on the vertices and faces.

Those 3 file types cover all the use cases, but 3d surfaces could be just vtk if it has to be just one filetype. I think that makes the most sense. but it does mean that there will often be duplicates of data. Additionally, most people who are familiar with 3D triangular mesh data will not be familiar with .vtk, but they will be familiar with stl and ply.

soichih commented 4 years ago

OK. I will proceed with treating neuro/3dsurface as vtk only. I will write an App to convert from vtk to other data formats soon.

.gii is neuroimaging specific. I thought the datatype "neuro/3DSurface" is for neuroimaging, no? (it's prefixed under neuro/ after all..) Should we rename it to be something more generic? How about "3d/vtk"?

As far as neuroimaging goes, gii (gifti) is supposed to be the .nii (nifti) equivalent of surface data. It's supported by BIDS and our lab members seem to be comfortable using it, as far as I can tell. Freesurfer doesn't output .gii directly, but it's trivial to convert surfaces to .gii (mris_convert). fmriprep outputs in .gii. Many other tools also allow data exchange with .gii.

I will generalize neuro/surface datatype ( https://brainlife.io/datatype/5dec20ff6c0bd9f84485779f) and use it to store output from pRF.

Thanks for all the info!

On Wed, Jan 22, 2020 at 1:53 PM Lindsey Kitchell notifications@github.com wrote:

3D surfaces should NOT be .gii. most apps do NOT handle .gii.

.gii should be a different datatype. It is a more specialized filetype, I think one just for neuroimaging? I think it comes from freesurfer?

The 3dsurface dataype has many purposes. It is not just for visualization/3d printing purposes at all. the surfaces are used for data analysis with the LB spectrum apps. They could also be used for many other data analyses.

The 3dsurfaces datatype should represent any data that is a 3d triangular mesh. Those triangular meshes ideally should be readable by 3D modeling or 3D viewing software (e.g. Meshlab, Blender). Unfortunately, there exists many, many filetypes for 3d triangular meshes (e.g. https://all3dp.com/3d-file-format-3d-files-3d-printer-3d-cad-vrml-stl-obj/ ).

.vtk is a filetype from the Visualization Toolkit (https://vtk.org/) and it is used with python and similar, mostly in coding and computer graphics situations, but it is not used by 3d modeling software (e.g. Meshlab and Blender do not read it I think). I think .vtk can save color information. .vtk is also not only for triangular meshes, it can hold many types of data.

.stl is used for 3d printing, but it can be used for any purpose that requires a 3d surface. It does not have any color information, just vertices and faces.

.ply is used for many 3d modeling purposes. It does save color information on the vertices and faces.

Those 3 file types cover all the use cases, but 3d surfaces could be just vtk if it has to be just one filetype. I think that makes the most sense. but it does mean that there will often be duplicates of data. Additionally, most people who are familiar with 3D triangular mesh data will not be familiar with .vtk, but they will be familiar with stl and ply.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kitchell/app-decimatemesh/issues/2?email_source=notifications&email_token=AAHBR6G5KLWON24ZQDLRN6LQ7CI2VA5CNFSM4KKI5FPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJUWF2I#issuecomment-577331945, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHBR6GLEUUUE5REUUJT37LQ7CI2VANCNFSM4KKI5FPA .