OpenWalnut  1.5.0dev
WMData.cpp
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #include <memory>
26 #include <string>
27 #include <vector>
28 
29 #include "core/common/WAssert.h"
30 #include "core/common/WIOTools.h"
31 #include "core/common/WPropertyHelper.h"
32 #include "core/dataHandler/exceptions/WDHException.h"
33 #include "core/dataHandler/WDataHandler.h"
34 #include "core/dataHandler/WDataSet.h"
35 #include "core/dataHandler/WDataSetScalar.h"
36 #include "core/dataHandler/WDataSetSingle.h"
37 #include "core/dataHandler/WDataSetTimeSeries.h"
38 #include "core/dataHandler/WDataSetVector.h"
39 #include "core/dataHandler/WDataTexture3D.h"
40 #include "core/dataHandler/WEEG2.h"
41 #include "core/dataHandler/WSubject.h"
42 #include "core/graphicsEngine/WGEColormapping.h"
43 #include "core/kernel/WDataModuleInputFile.h"
44 #include "core/kernel/WDataModuleInputFilterFile.h"
45 #include "core/kernel/WModuleOutputData.h"
46 
47 #ifdef WBIOSIG_ENABLED
48  #include "io/WReaderBiosig.h"
49 #endif
50 #include "io/WReaderClustering.h"
51 #include "io/WReaderCSV.h"
52 #include "io/WReaderEEGASCII.h"
53 #include "io/WReaderELC.h"
54 #include "io/WReaderFiberVTK.h"
55 #ifdef WEEP_ENABLED
56  #include "io/WReaderLibeep.h"
57  #include "io/WPagerEEGLibeep.h"
58 #endif
59 #include "io/WReaderNIfTI.h"
60 #include "io/WReaderVTK.h"
61 
62 #include "WMData.h"
63 #include "WMData.xpm"
64 
65 
67  WDataModule(),
68  m_isTexture(),
69  m_transformNoMatrix( 4, 4 ),
70  m_transformSForm( 4, 4 ),
71  m_transformQForm( 4, 4 )
72 {
73  // initialize members
74 }
75 
77 {
78  // cleanup
79 }
80 
81 std::shared_ptr< WModule > WMData::factory() const
82 {
83  return std::shared_ptr< WModule >( new WMData() );
84 }
85 
86 const char** WMData::getXPMIcon() const
87 {
88  return WMData_xpm;
89 }
90 
91 const std::string WMData::getName() const
92 {
93  return "Data Module";
94 }
95 
96 const std::string WMData::getDescription() const
97 {
98  return "This module encapsulates data.";
99 }
100 
101 std::vector< WDataModuleInputFilter::ConstSPtr > WMData::getInputFilter() const
102 {
103  std::vector< WDataModuleInputFilter::ConstSPtr > filters;
104 
105  // NOTE: plain extension. No wildcards or prefixing "."!
106  filters.push_back( WDataModuleInputFilter::ConstSPtr( new WDataModuleInputFilterFile( "nii", "NIfTI files" ) ) );
107  filters.push_back( WDataModuleInputFilter::ConstSPtr( new WDataModuleInputFilterFile( "nii.gz", "Compressed NIfTI files" ) ) );
108  filters.push_back( WDataModuleInputFilter::ConstSPtr( new WDataModuleInputFilterFile( "csv", "Comma separated values" ) ) );
109 #ifdef WBIOSIG_ENABLED
110  filters.push_back( WDataModuleInputFilter::ConstSPtr( new WDataModuleInputFilterFile( "edf", "EEG files (BioSig)" ) ) );
111 #endif
112  filters.push_back( WDataModuleInputFilter::ConstSPtr( new WDataModuleInputFilterFile( "cnt", "EEG files" ) ) );
113  filters.push_back( WDataModuleInputFilter::ConstSPtr( new WDataModuleInputFilterFile( "asc", "EEG files" ) ) );
114  filters.push_back( WDataModuleInputFilter::ConstSPtr( new WDataModuleInputFilterFile( "vtk", "VTK files, limited support" ) ) );
115  filters.push_back( WDataModuleInputFilter::ConstSPtr( new WDataModuleInputFilterFile( "fib", "VTK Fiber files" ) ) );
116  filters.push_back( WDataModuleInputFilter::ConstSPtr( new WDataModuleInputFilterFile( "fdg", "Cluster Files" ) ) );
117  return filters;
118 }
119 
121 {
122  // initialize connectors
123  m_output= std::shared_ptr< WModuleOutputData< WDataSet > >( new WModuleOutputData< WDataSet >(
124  shared_from_this(), "out", "A loaded dataset." )
125  );
126 
127  // add it to the list of connectors. Please note, that a connector NOT added via addConnector will not work as expected.
129 
130  // call WModules initialization
132 }
133 
135 {
136  m_propCondition = std::shared_ptr< WCondition >( new WCondition() );
137 
138  // Add standard datamodule props
140 
141  // properties
142  m_dataName = m_infoProperties->addProperty( "Filename", "The filename of the dataset.", std::string( "" ) );
143  m_dataType = m_infoProperties->addProperty( "Data type", "The type of the single data values.", std::string( "" ) );
144  m_dataSetType = m_infoProperties->addProperty( "Dataset type", "The name of the dataset type.", std::string( "" ) );
145 
146  m_matrixSelectionsList = std::shared_ptr< WItemSelection >( new WItemSelection() );
147  m_matrixSelectionsList->addItem( "No matrix", "" );
148  m_matrixSelectionsList->addItem( "sform", "" );
149  m_matrixSelectionsList->addItem( "qform", "" );
150 
151  m_matrixSelection = m_properties->addProperty( "Transformation matrix", "matrix",
152  m_matrixSelectionsList->getSelectorFirst(), m_propCondition );
154 
155  // use this callback for the other properties
156  WPropertyBase::PropertyChangeNotifierType propertyCallback = boost::bind( &WMData::propertyChanged, this, boost::placeholders::_1 );
157 }
158 
159 void WMData::propertyChanged( std::shared_ptr< WPropertyBase > property )
160 {
161  if( m_isTexture )
162  {
163  if( property == m_active )
164  {
165  // forward to texture
166  m_dataSet->getTexture()->active()->set( m_active->get( true ) );
167  }
168  }
169  else
170  {
171  if( property == m_active )
172  {
173  if( m_active->get() )
174  {
175  m_output->updateData( m_dataSet );
176  }
177  else
178  {
179  m_output->updateData( std::shared_ptr< WDataSet >() );
180  }
181  }
182  }
183 }
184 
186 {
187  // notify the module only
188  m_reload = true;
190 }
191 
193 {
194  m_moduleState.setResetable( true, true );
197 
198  ready();
199  waitRestored();
200 
201  while( !m_shutdownFlag() )
202  {
204  if( m_shutdownFlag() )
205  {
206  break;
207  }
208 
209  if( m_reload )
210  {
211  load();
212  }
213 
214  // change transform matrix (only if we have a dataset single which contains the grid)
215  if( m_matrixSelection->changed() && m_dataSetAsSingle )
216  {
217  matrixUpdate();
218  }
219  }
220 
221  // remove dataset from datahandler
222  updateColorMap( std::shared_ptr< WDataSet >() );
223 }
224 
225 // TODO(wiebel): move this to some central place.
226 std::string WMData::getDataTypeString( std::shared_ptr< WDataSetSingle > dss )
227 {
228  std::string result;
229  switch( ( *dss ).getValueSet()->getDataType() )
230  {
231  case W_DT_NONE:
232  result = "none";
233  break;
234  case W_DT_BINARY:
235  result = "binary (1 bit)";
236  break;
237  case W_DT_UNSIGNED_CHAR:
238  result = "unsigned char (8 bits)";
239  break;
240  case W_DT_SIGNED_SHORT:
241  result = "signed short (16 bits)";
242  break;
243  case W_DT_SIGNED_INT:
244  result = "signed int (32 bits)";
245  break;
246  case W_DT_FLOAT:
247  result = "float (32 bits)";
248  break;
249  case W_DT_COMPLEX:
250  result = "complex";
251  break;
252  case W_DT_DOUBLE:
253  result = "double (64 bits)";
254  break;
255  case W_DT_RGB:
256  result = "RGB triple (24 bits)";
257  break;
258  case W_DT_ALL:
259  result = "ALL (not very useful)";
260  break;
261  case W_DT_INT8:
262  result = "signed char (8 bits)";
263  break;
264  case W_DT_UINT16:
265  result = "unsigned short (16 bits)";
266  break;
267  case W_DT_UINT32 :
268  result = "unsigned int (32 bits)";
269  break;
270  case W_DT_INT64:
271  result = "int64";
272  break;
273  case W_DT_UINT64:
274  result = "unsigned long long (64 bits)";
275  break;
276  case W_DT_FLOAT128:
277  result = "float (128 bits)";
278  break;
279  case W_DT_COMPLEX128:
280  result = "double pair (128 bits)";
281  break;
282  case W_DT_COMPLEX256:
283  result = " long double pair (256 bits)";
284  break;
285  case W_DT_RGBA32:
286  result = "4 byte RGBA (32 bits)";
287  break;
288  default:
289  WAssert( false, "Unknow data type in getDataTypeString" );
290  }
291  return result;
292 }
293 
294 namespace
295 {
296  // helper which gets a WMatrix< double > and returns a WMatrix4d
297  WMatrix4d WMatrixDoubleToWMatrix4d( const WMatrix< double >& matrix )
298  {
299  WAssert( matrix.getNbRows() == 4, "" );
300  WAssert( matrix.getNbCols() == 4, "" );
301  WMatrix4d result;
302  for( size_t i = 0; i < 4; ++i )
303  {
304  for( size_t j = 0; j < 4; ++j )
305  {
306  result( i, j ) = matrix( i, j );
307  }
308  }
309  return result;
310  }
311 }
312 
314 {
315  // incase that m_dataSet is not a WDataSetSingle e.g. WDataSetFibers, the cast might be NULL
316  if( std::dynamic_pointer_cast< WDataSetSingle >( m_dataSet ) )
317  {
318  debugLog() << "Matrix mode update.";
319 
320  // a new grid
321  std::shared_ptr< WGrid > newGrid;
322  std::shared_ptr< WGridRegular3D > oldGrid = std::dynamic_pointer_cast< WGridRegular3D >( m_dataSetAsSingle->getGrid() );
323 
324  switch( m_matrixSelection->get( true ).getItemIndexOfSelected( 0 ) )
325  {
326  case 0:
327  newGrid = std::shared_ptr< WGrid >( new WGridRegular3D( oldGrid->getNbCoordsX(), oldGrid->getNbCoordsY(), oldGrid->getNbCoordsZ(),
329  break;
330  case 1:
331  newGrid = std::shared_ptr< WGrid >( new WGridRegular3D( oldGrid->getNbCoordsX(), oldGrid->getNbCoordsY(), oldGrid->getNbCoordsZ(),
333  break;
334  case 2:
335  newGrid = std::shared_ptr< WGrid >( new WGridRegular3D( oldGrid->getNbCoordsX(), oldGrid->getNbCoordsY(), oldGrid->getNbCoordsZ(),
337  break;
338  }
339 
340  // Update the m_dataSet
341  m_dataSet = m_dataSetAsSingle->clone( newGrid );
342 
343  // carry over old properties (i.e. colormap) except for the new transform
344  if( m_dataSet->isTexture() && m_dataSet->getTexture() )
345  {
346  m_dataSet->getTexture()->copyPropertiesExceptTransformation( m_dataSetAsSingle->getTexture() );
347  }
348  m_dataSetAsSingle = std::dynamic_pointer_cast< WDataSetSingle >( m_dataSet );
349 
350  // Remove all old props
351  if( m_oldDataSet )
352  {
353  m_properties->removeProperty( m_oldDataSet->getProperties() );
354  m_infoProperties->removeProperty( m_oldDataSet->getInformationProperties() );
355  m_infoProperties->removeProperty( m_infoProperties->findProperty( "Transformations" ) );
356  }
357 
358  // Add new props
359  m_properties->addProperty( m_dataSet->getProperties() );
360  m_infoProperties->addProperty( m_dataSet->getInformationProperties() );
362 
363  // the clone() may have returned a zero-pointer, only update if it hasn't
364  // this may happen if the clone() operation has not been implemented in the derived dataset class
366 
368  }
369 
370  m_output->updateData( m_dataSet ); // need to update output connector also in case of non WDataSetSingle, as this hasnt been done before
371 }
372 
373 std::shared_ptr< WProperties > WMData::getTransformationProperties() const
374 {
375  std::shared_ptr< WProperties > result( new WProperties( "Transformations", "Availabe transformation matrices for data-set " ) );
376  WPropGroup transformation = result->addPropertyGroup( "Transformation",
377  "The transformation of this grid." );
378  WPropMatrix4X4 noMatrixTransformation = result->addProperty( "No matrix transformation",
379  "The no matrix transformation for this data set.",
380  WMatrixDoubleToWMatrix4d( m_transformNoMatrix ) );
381  WPropMatrix4X4 sformMatrixTransformation = result->addProperty( "sform matrix transformation",
382  "The sform matrix transformation for this data set.",
383  WMatrixDoubleToWMatrix4d( m_transformSForm ) );
384  WPropMatrix4X4 qformMatrixTransformation = result->addProperty( "qform matrix transformation",
385  "The qform matrix transformation for this data set.",
386  WMatrixDoubleToWMatrix4d( m_transformQForm ) );
387  return result;
388 }
389 
390 void WMData::updateColorMap( std::shared_ptr< WDataSet > dataSet )
391 {
392  // remove dataset from datahandler
393  if( m_oldColormap )
394  {
395  m_properties->removeProperty( m_oldColormap->getProperties() );
396  m_infoProperties->removeProperty( m_oldColormap->getInformationProperties() );
398  m_oldColormap = osg::ref_ptr< WDataTexture3D >();
399  }
400 
401  if( dataSet )
402  {
403  // remove dataset from datahandler
404  if( dataSet->isTexture() )
405  {
406  if( !getSuppressColormaps() )
407  {
408  WGEColormapping::registerTexture( dataSet->getTexture(), m_runtimeName->get() );
409  }
410  m_properties->addProperty( dataSet->getTexture()->getProperties() );
411  m_infoProperties->addProperty( dataSet->getTexture()->getInformationProperties() );
412 
413  m_oldColormap = dataSet->getTexture();
414  }
415  }
416 }
417 
419 {
420  // remove dataset from datahandler
421  updateColorMap( std::shared_ptr< WDataSet >() );
422 
423  // remove props
424  if( m_oldDataSet )
425  {
426  m_properties->removeProperty( m_oldDataSet->getProperties() );
427  m_infoProperties->removeProperty( m_oldDataSet->getInformationProperties() );
428  m_infoProperties->removeProperty( m_infoProperties->findProperty( "Transformations" ) );
429  }
430 
431  m_dataName->set( "" );
432  m_dataType->set( "" );
433  m_dataSetType->set( "" );
434 
435  // clear connector
436  m_output->updateData( WDataSet::SPtr() );
437 }
438 
440 {
441  // remove old properties
442  if( m_dataSet )
443  {
444  m_infoProperties->removeProperty( m_dataSet->getInformationProperties() );
445  }
446 
447  // Get the input
448  WDataModuleInputFile::SPtr inputFile = getInputAs< WDataModuleInputFile >();
449  if( !inputFile )
450  {
451  // No input? Reset output too.
452  cleanUp();
453  return;
454  }
455  std::string fileName = inputFile->getFilename().string();
456 
457  std::shared_ptr< WProgress > progress1( new WProgress( "Loading" ) );
458  m_progress->addSubProgress( progress1 );
459 
463 
464  debugLog() << "Loading data from \"" << fileName << "\".";
465  m_dataName->set( fileName );
466 
467  // load it now
468  std::string suffix = getSuffix( fileName );
469  if( suffix == ".nii" || ( suffix == ".gz" && ::nifti_compiled_with_zlib() ) )
470  {
471  if( suffix == ".gz" ) // it may be a NIfTI file too
472  {
473  boost::filesystem::path p( fileName );
474  p.replace_extension( "" );
475 
476  if( boost::filesystem::exists( p ) && !boost::filesystem::is_directory( p ) )
477  {
478  warnLog() << "Loading file " << fileName << " and a file with the name " << p <<
479  " was found. This may lead to problems loading the data due to an issue with the niftiio-lib.";
480  }
481 
482  suffix = getSuffix( p.string() );
483  WAssert( suffix == ".nii", "Currently only nii files may be gzipped." );
484  }
485 
486  WReaderNIfTI niiLoader( fileName );
487  m_dataSet = niiLoader.load();
489  m_transformSForm = niiLoader.getSFormTransform();
490  m_transformQForm = niiLoader.getQFormTransform();
491 
492  m_isTexture = m_dataSet->isTexture();
493 
494  std::shared_ptr< WDataSetSingle > dss = std::dynamic_pointer_cast< WDataSetSingle >( m_dataSet );
495  if( dss )
496  {
497  m_dataType->set( getDataTypeString( dss ) );
498  if( dss->isTexture() )
499  {
500  switch( ( *dss ).getValueSet()->getDataType() )
501  {
502  case W_DT_UNSIGNED_CHAR:
503  case W_DT_INT16:
504  case W_DT_UINT16:
505  case W_DT_UINT32:
506  case W_DT_SIGNED_INT:
507  m_dataSet->getTexture()->colormap()->set(
508  m_dataSet->getTexture()->colormap()->get().newSelector( WItemSelector::IndexList( 1, 0 ) )
509  );
510  break;
511  case W_DT_FLOAT:
512  case W_DT_DOUBLE:
513  if( std::dynamic_pointer_cast< WDataSetVector >( m_dataSet ) )
514  {
515  m_dataSet->getTexture()->colormap()->set(
516  m_dataSet->getTexture()->colormap()->get().newSelector( WItemSelector::IndexList( 1, 6 ) )
517  );
518  m_dataSet->getTexture()->interpolation()->set( false );
519  }
520  else
521  {
522  m_dataSet->getTexture()->colormap()->set(
523  m_dataSet->getTexture()->colormap()->get().newSelector( WItemSelector::IndexList( 1, 5 ) )
524  );
525  }
526  break;
527  default:
528  WAssert( false, "Could not load \"" + fileName + "\". Reason: unknown data type in Data module" );
529  }
530  }
531  }
532  }
533 #ifdef WBIOSIG_ENABLED
534  else if( suffix == ".edf" ) // NOLINT: An else should appear after closing } in previous line
535  {
536  WReaderBiosig biosigLoader( fileName );
537  m_dataSet = biosigLoader.load();
538  }
539 #endif
540  else if( suffix == ".asc" ) // NOLINT: An else should appear after closing } in previous line
541  {
542  WReaderEEGASCII eegAsciiLoader( fileName );
543  m_dataSet = eegAsciiLoader.load();
544  }
545 #ifdef WEEP_ENABLED
546  else if( suffix == ".cnt" ) // NOLINT: An else should appear after closing } in previous line
547  {
548  std::shared_ptr< WPagerEEG > pager( new WPagerEEGLibeep( fileName ) );
549 
550  std::string elcFileName = fileName;
551  elcFileName.resize( elcFileName.size() - 3 ); // drop suffix
552  elcFileName += "elc"; // add new suffix
553  WReaderELC elcReader( elcFileName );
554  std::shared_ptr< WEEGPositionsLibrary > eegPositionsLibrary = elcReader.read();
555 
556  m_dataSet = std::shared_ptr< WEEG2 >( new WEEG2( pager, eegPositionsLibrary ) );
557  }
558 #endif
559  else if( suffix == ".fib" ) // NOLINT: An else should appear after closing } in previous line
560  {
561  WReaderFiberVTK fibReader( fileName );
562  m_dataSet = fibReader.read();
563  }
564  else if( suffix == ".fdg" )
565  {
566  WReaderClustering clusterReader( fileName );
567  m_dataSet = clusterReader.read();
568  }
569  else if( suffix == ".vtk" )
570  {
571  WReaderVTK vtkReader( fileName );
572  m_dataSet = vtkReader.read();
573  }
574  else if( suffix == ".csv" )
575  {
576  WReaderCSV csvReader( fileName );
577  m_dataSet = csvReader.read();
578  }
579  else
580  {
581  throw WDHException( std::string( "Could not load \"" + fileName + "\". Reason: unknown file type: \"" + suffix + "\"" ) );
582  }
583 
584  if( !m_dataSet )
585  {
586  throw WDHException( std::string( "Could not load \"" + fileName + "\". Possibly format not supported." ) );
587  }
588 
589  debugLog() << "Loading data done.";
590 
591  // set the dataset name
592  m_dataSetType->set( m_dataSet->getName() );
593 
594  // I am interested in the active property ( manually subscribe signal )
595  m_active->getCondition()->subscribeSignal( boost::bind( &WMData::propertyChanged, this, m_active ) );
596 
597  // notify
598  m_dataSetAsSingle = std::dynamic_pointer_cast< WDataSetSingle >( m_dataSet );
599 
600  // Update matrix
601  matrixUpdate();
602 
603  // done. close file and report finish
604  progress1->finish();
605 
606  // remove old left over info properties
607  m_infoProperties->removeProperty( m_infoProperties->findProperty( "Data-Set Info Properties" ) );
608  // add current info properties
609  m_infoProperties->addProperty( m_dataSet->getInformationProperties() );
610 }
virtual void wait() const
Wait for the condition.
void setResetable(bool resetable=true, bool autoReset=true)
Sets the resetable flag.
virtual void add(std::shared_ptr< WCondition > condition)
Adds another condition to the set of conditions to wait for.
virtual void notify()
Notifies all waiting threads.
Class to encapsulate boost::condition_variable_any.
Definition: WCondition.h:42
General purpose exception and therefore base class for all DataHandler related exceptions.
Definition: WDHException.h:40
std::shared_ptr< WDataModuleInputFile > SPtr
Convenience typedef for a std::shared_ptr< WDataModuleInputFile >.
Checks a given WDataModuleInput against a file type.
std::shared_ptr< const WDataModuleInputFilter > ConstSPtr
Convenience typedef for a std::shared_ptr< const WDataModuleInputFilter >.
Base for all data loader modules.
Definition: WDataModule.h:47
bool getSuppressColormaps() const
Checks whether suppression of colormaps is active.
Definition: WDataModule.cpp:51
std::shared_ptr< WDataSet > SPtr
Shared pointer abbreviation to a instance of this class.
Definition: WDataSet.h:55
Class which contains EEG recording data, read from a WPagerEEG.
Definition: WEEG2.h:47
static void registerTexture(osg::ref_ptr< WGETexture3D > texture, std::string name="")
Register the specified texture to the colormapper.
static void deregisterTexture(osg::ref_ptr< WGETexture3D > texture)
De-register the specified texture to the colormapper.
A grid that has parallelepiped cells which all have the same proportion.
Implements an orthogonal grid transformation.
A class containing a list of named items.
std::vector< size_t > IndexList
The type used for storing index lists.
Definition: WItemSelector.h:59
virtual void properties()
Initialize properties in this function.
Definition: WMData.cpp:134
std::shared_ptr< WDataSet > m_oldDataSet
Keep track of the old dataset.
Definition: WMData.h:219
void load()
Do the loading.
Definition: WMData.cpp:439
osg::ref_ptr< WDataTexture3D > m_oldColormap
Keep track of registered colormaps.
Definition: WMData.h:214
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
Definition: WMData.cpp:86
void updateColorMap(std::shared_ptr< WDataSet > dataSet)
Add the colormapping.
Definition: WMData.cpp:390
std::shared_ptr< WItemSelection > m_matrixSelectionsList
A list of color map selection types.
Definition: WMData.h:131
WPropSelection m_matrixSelection
Selection property for color map.
Definition: WMData.h:136
void cleanUp()
Clean up.
Definition: WMData.cpp:418
virtual std::vector< WDataModuleInputFilter::ConstSPtr > getInputFilter() const
Define a list of file filters we support.
Definition: WMData.cpp:101
std::shared_ptr< WProperties > getTransformationProperties() const
Returns info property group with the three availabe transformation matrixes.
Definition: WMData.cpp:373
WMatrix< double > m_transformQForm
a standard transform (should be an identity transform)
Definition: WMData.h:155
void propertyChanged(std::shared_ptr< WPropertyBase > property)
Called whenever a property changes.
Definition: WMData.cpp:159
WMatrix< double > m_transformSForm
a standard transform (should be an identity transform)
Definition: WMData.h:152
WDataSetSingle::SPtr m_dataSetAsSingle
As single.
Definition: WMData.h:209
virtual void connectors()
Initialize connectors in this function.
Definition: WMData.cpp:120
virtual void handleInputChange()
Handle a newly set input.
Definition: WMData.cpp:185
WPropString m_dataName
The name of the dataset.
Definition: WMData.h:116
virtual const std::string getDescription() const
Gives back a description of this module.
Definition: WMData.cpp:96
std::shared_ptr< WModuleOutputData< WDataSet > > m_output
The only output of this data module.
Definition: WMData.h:204
std::string getDataTypeString(std::shared_ptr< WDataSetSingle > dss)
Get a string for the datatype of the given dataset.
Definition: WMData.cpp:226
WMatrix< double > m_transformNoMatrix
a standard transform (should be an identity transform)
Definition: WMData.h:149
WMData()
Default constructor.
Definition: WMData.cpp:66
std::shared_ptr< WCondition > m_propCondition
a condition for the matrix selection
Definition: WMData.h:185
bool m_isTexture
Indicates whether the loaded dataSet will be available as texture.
Definition: WMData.h:138
virtual ~WMData()
Destructor.
Definition: WMData.cpp:76
bool m_reload
True if the load function needs to be called.
Definition: WMData.h:236
virtual const std::string getName() const
Gives back the name of this module.
Definition: WMData.cpp:91
std::shared_ptr< WDataSet > m_dataSet
The associated dataset.
Definition: WMData.h:199
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
Definition: WMData.cpp:81
virtual void moduleMain()
Definition: WMData.cpp:192
void matrixUpdate()
Update matrix.
Definition: WMData.cpp:313
WPropString m_dataType
The basic type of data used in this data set (e.g.
Definition: WMData.h:121
WPropString m_dataSetType
The name of the dataset type created from the data (e.g.
Definition: WMData.h:126
size_t getNbRows() const
Get number of rows.
Definition: WMatrix.h:375
size_t getNbCols() const
Get number of columns.
Definition: WMatrix.h:383
WMatrix & makeIdentity()
Makes the matrix contain the identity matrix, i.e.
Definition: WMatrix.h:352
Class offering an instantiate-able data connection between modules.
virtual void properties()
Initialize properties in this function.
Definition: WModule.cpp:212
wlog::WStreamedLogger debugLog() const
Logger instance for comfortable debug logging.
Definition: WModule.cpp:575
void addConnector(std::shared_ptr< WModuleInputConnector > con)
Adds the specified connector to the list of inputs.
Definition: WModule.cpp:108
wlog::WStreamedLogger warnLog() const
Logger instance for comfortable warning- logs.
Definition: WModule.cpp:580
std::shared_ptr< WProperties > m_properties
The property object for the module.
Definition: WModule.h:640
std::shared_ptr< WProperties > m_infoProperties
The property object for the module containing only module whose purpose is "PV_PURPOSE_INFORMNATION".
Definition: WModule.h:647
void ready()
Call this whenever your module is ready and can react on property changes.
Definition: WModule.cpp:505
WConditionSet m_moduleState
The internal state of the module.
Definition: WModule.h:703
WPropBool m_active
True whenever the module should be active.
Definition: WModule.h:723
WPropString m_runtimeName
This property holds a user specified name for the current module instance.
Definition: WModule.h:728
std::shared_ptr< WProgressCombiner > m_progress
Progress indicator used as parent for all progress' of this module.
Definition: WModule.h:652
virtual void connectors()
Initialize connectors in this function.
Definition: WModule.cpp:208
void waitRestored()
This method waits for the module to be restored completely.
Definition: WModule.cpp:625
Class managing progress inside of modules.
Definition: WProgress.h:42
boost::function< void(std::shared_ptr< WPropertyBase >)> PropertyChangeNotifierType
Signal signature emitted during set operations.
Class to manage properties of an object and to provide convenience methods for easy access and manipu...
Read content from a CSV file.
Definition: WReaderCSV.h:43
virtual std::shared_ptr< WDataSetCSV > read()
Read the file and create a dataset as a vector.
Definition: WReaderCSV.cpp:74
Reads a hierarchical clustering from a FDG file.
virtual std::shared_ptr< WDataSetHierarchicalClustering > read()
Reads the clustering file and creates a dataset out of it.
Reader for EEG data in ASCII fromat.
virtual std::shared_ptr< WDataSet > load()
Loads the dataset.
Read electrode positions from an ELC file.
Definition: WReaderELC.h:40
std::shared_ptr< WEEGPositionsLibrary > read()
Read the file and create a dataset out of it.
Definition: WReaderELC.cpp:47
Reads fibers from a VTK file.
virtual std::shared_ptr< WDataSetFibers > read()
Reads the fiber file and creates a dataset out of it.
Reader for the NIfTI file format.
Definition: WReaderNIfTI.h:43
WMatrix< double > getQFormTransform() const
Returns the QForm transformation stored in the nifti file's header.
WMatrix< double > getSFormTransform() const
Returns the SForm transformation stored in the nifti file's header.
WMatrix< double > getStandardTransform() const
Returns a standard transformation.
virtual std::shared_ptr< WDataSet > load(DataSetType dataSetType=W_DATASET_NONE)
Loads the dataset.
Reads simple VTK files.
Definition: WReaderVTK.h:57
virtual std::shared_ptr< WDataSet > read()
Reads the data file and creates a dataset out of it.
Definition: WReaderVTK.cpp:58
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.
void addTo(WPropSelection prop)
Add the PC_SELECTONLYONE constraint to the property.