[OpenWalnut-Dev] [OWci] r5271: [ADD #83] added new handled data types
Sebastian Eichelbaum
eichelbaum at informatik.uni-leipzig.de
Wed Oct 5 12:37:42 CEST 2011
Please add the missing ones to marching cubes because:
* WReadNifiti supports all integral/float type
* WDataTexture3D supports them all
* I also added long double to our data type traits and GL type traits
* Marching Cubes algo is a template
* it already is tested. Another type T does not change the logic behind the algorithm
Please always consider to support all the types if you write algorithms, especially if they are template functions/classes (they somehow where invented for this reason) . In this context, it is always worth a look into core/dataHandler/WDataHandlerEnums, core/graphicsEngine/WGLTypeTraits and core/common/WTypeTraits. They contain several templates to make life easier and can map certain nifti types to c++ types and similar stuff.
Bye
Sebastian
On Tue, 04 Oct 2011, Alexander Wiebel wrote:
> Hi
> > Nice. But please be so kind to check whether marching cubes now supports ALL integral/float types we support and please add them if missing.
>
> It support more than we can load from from NIfTI at the moment. One can
> argue whether this is enough. One could aim at supporting all sensible
> types in WDataHandlerEnums, e.g. all marked with # in the following list. However we do not have data for every thing so it will be hard to test if it works at the moment. If it is of interest I can implement a module than can produce test data in an arbitrary data type.
>
> W_DT_NONE = 0,
> W_DT_UNKNOWN = 0, /* what it says, dude */
> W_DT_BINARY = 1, /* binary (1 bit/voxel) */
> # W_DT_UNSIGNED_CHAR = 2, /* unsigned char (8 bits/voxel) */
> # W_DT_SIGNED_SHORT = 4, /* signed short (16 bits/voxel) */
> # W_DT_SIGNED_INT = 8, /* signed int (32 bits/voxel) */
> # W_DT_FLOAT = 16, /* float (32 bits/voxel) */
> W_DT_COMPLEX = 32, /* complex (64 bits/voxel) */
> # W_DT_DOUBLE = 64, /* double (64 bits/voxel) */
> W_DT_RGB = 128, /* RGB triple (24 bits/voxel) */
> W_DT_ALL = 255, /* not very useful (?) */
> # W_DT_INT8 = 256, /* signed char (8 bits) */
> # W_DT_UINT16 = 512, /* unsigned short (16 bits) */
> # W_DT_UINT8 = 2, /* alias for unsigned char (8 bits/voxel) */
> # W_DT_INT16 = 4, /* unsigned short (16 bits) alias name for W_DT_SIGNED_SHORT */
> # W_DT_UINT32 = 768, /* unsigned int (32 bits) */
> # W_DT_INT64 = 1024, /* long long (64 bits) */
> # W_DT_UINT64 = 1280, /* unsigned long long (64 bits) */
> # W_DT_FLOAT128 = 1536, /* long double (128 bits) */
> W_DT_COMPLEX128 = 1792, /* double pair (128 bits) */
> W_DT_COMPLEX256 = 2048, /* long double pair (256 bits) */
> W_DT_RGBA32 = 2304 /* 4 byte RGBA (32 bits/voxel) */
>
>
> Cheers
> Alex
>
>
> > Thank You
> > Sebastian
> >
> > On Tue, 04 Oct 2011, Alexander Wiebel wrote:
> >
> >> *Branch default*
> >> [ADD #83] added new handled data types
> >>
> >> changeset 5271:ab06c7fef65e in /srv/hg/ow (Tue Oct 04 17:31:28 2011 +0200):
> >>
> >> http://www.openwalnut.org/projects/openwalnut/repository/revisions/5271
> >>
> >> diffstat:
> >>
> >> src/modules/data/WMData.cpp | 1 +
> >> src/modules/marchingCubes/WMMarchingCubes.cpp | 44 +++++++++++++++++++++++++++
> >> 2 files changed, 45 insertions(+), 0 deletions(-)
> >>
> >> diffs (72 lines):
> >>
> >> diff -r 738aff79abae -r ab06c7fef65e src/modules/data/WMData.cpp
> >> --- a/src/modules/data/WMData.cpp Mon Oct 03 13:39:21 2011 +0200
> >> +++ b/src/modules/data/WMData.cpp Tue Oct 04 17:31:28 2011 +0200
> >> @@ -223,6 +223,7 @@
> >> case W_DT_UNSIGNED_CHAR:
> >> case W_DT_INT16:
> >> case W_DT_UINT16:
> >> + case W_DT_UINT32:
> >> case W_DT_SIGNED_INT:
> >> m_dataSet->getTexture()->colormap()->set(
> >> m_dataSet->getTexture()->colormap()->get().newSelector( WItemSelector::IndexList( 1, 0 ) )
> >> diff -r 738aff79abae -r ab06c7fef65e src/modules/marchingCubes/WMMarchingCubes.cpp
> >> --- a/src/modules/marchingCubes/WMMarchingCubes.cpp Mon Oct 03 13:39:21 2011 +0200
> >> +++ b/src/modules/marchingCubes/WMMarchingCubes.cpp Tue Oct 04 17:31:28 2011 +0200
> >> @@ -283,6 +283,28 @@
> >> }
> >> break;
> >> }
> >> + case W_DT_INT8:
> >> + {
> >> + boost::shared_ptr< WValueSet< int8_t > > vals;
> >> + vals = boost::shared_dynamic_cast< WValueSet< int8_t > >( ( *m_dataSet ).getValueSet() );
> >> + WAssert( vals, "Data type and data type indicator must fit." );
> >> + if( m_useMarchingLego->get( true ) )
> >> + {
> >> + m_triMesh = mlAlgo.generateSurface( m_grid->getNbCoordsX(), m_grid->getNbCoordsY(), m_grid->getNbCoordsZ(),
> >> + m_grid->getTransformationMatrix(),
>> + vals->rawDataVectorPointer(),
> >> + isoValue );
> >> + }
> >> + else
> >> + {
> >> + m_triMesh = mcAlgo.generateSurface( m_grid->getNbCoordsX(), m_grid->getNbCoordsY(), m_grid->getNbCoordsZ(),
> >> + m_grid->getTransformationMatrix(),
> >> + vals->rawDataVectorPointer(),
> >> + isoValue,
> >> + m_progress );
> >> + }
> >> + break;
> >> + }
> >> case W_DT_UINT16:
> >> {
> >> boost::shared_ptr< WValueSet< uint16_t > > vals;
> >> @@ -305,6 +327,28 @@
> >> }
> >> break;
> >> }
> >> + case W_DT_UINT32:
> >> + {
> >> + boost::shared_ptr< WValueSet< uint32_t > > vals;
> >> + vals = boost::shared_dynamic_cast< WValueSet< uint32_t > >( ( *m_dataSet ).getValueSet() );
> >> + WAssert( vals, "Data type and data type indicator must fit." );
> >> + if( m_useMarchingLego->get( true ) )
> >> + {
> >> + m_triMesh = mlAlgo.generateSurface( m_grid->getNbCoordsX(), m_grid->getNbCoordsY(), m_grid->getNbCoordsZ(),
> >> + m_grid->getTransformationMatrix(),
> >> + vals->rawDataVectorPointer(),
> >> + isoValue );
> >> + }
> >> + else
> >> + {
> >> + m_triMesh = mcAlgo.generateSurface( m_grid->getNbCoordsX(), m_grid->getNbCoordsY(), m_grid->getNbCoordsZ(),
> >> + m_grid->getTransformationMatrix(),
> >> + vals->rawDataVectorPointer(),
> >> + isoValue,
> >> + m_progress );
> >> + }
> >> + break;
> >> + }
> >> case W_DT_SIGNED_INT:
> >> {
> >> boost::shared_ptr< WValueSet< int32_t > > vals;
> >> _______________________________________________
> >> All-openwalnut-commits mailing list
> >> All-openwalnut-commits at lists.informatik.uni-leipzig.de
> >> http://lists.informatik.uni-leipzig.de/mailman/listinfo/all-openwalnut-commits
> >>
> >
>
> _______________________________________________
> OpenWalnut-Dev mailing list
> OpenWalnut-Dev at lists.informatik.uni-leipzig.de
> http://lists.informatik.uni-leipzig.de/mailman/listinfo/openwalnut-dev
>
--
Dipl.-Inf. Sebastian Eichelbaum
Universität Leipzig
Institut für Informatik
Abteilung Bild- und Signalverarbeitung
PF 100920
D-04009 Leipzig
More information about the OpenWalnut-Dev
mailing list