3232 * DATE: 17 OCT 2004
3333 */
3434
35- #include < math.h>
3635#include < Core/Matlab/matlabconverter.h>
37- #include < Core/Datatypes/MatrixTypeConverter.h>
38- #include < Core/Datatypes/Matrix.h>
3936
40- namespace MatlabIO {
37+ using namespace SCIRun :: MatlabIO;
4138
42- using namespace SCIRun ;
4339
4440// Currently the property converter only manages strings
45- // all other data is ignored both on matlabside as well
41+ // all other data is ignored both on matlab side as well
4642// as on the property manager side.
4743
4844/* DESIGN NOTES : */
@@ -55,21 +51,21 @@ using namespace SCIRun;
5551 * which leads to a huge conversion problem. Hence only the useful
5652 * objects are translated the rest is just discarded. Until there
5753 * is a better data management structure within SCIRun, the conversion
58- * process is basically a big switch statemet scanning for each possible
54+ * process is basically a big switch statement scanning for each possible
5955 * object structure
6056 */
6157
6258/*
6359 * With the hope in mind that a better data management system will be
6460 * in place in the future, all conversion algorithms are grouped in
65- * this one object. All the other matlab classes function independent
61+ * this one object. All the other Matlab classes function independent
6662 * of the main SCIRun structure, it has its own memory and data management
67- * making it easier to adapt to future changes. The separation of matlab
68- * and SCIRun data management has the advantage that the matlab side can be
69- * further enhanced to deal with different future matlab fileformats , without
70- * having to comb through the conversion prs . Though there is a little
63+ * making it easier to adapt to future changes. The separation of Matlab
64+ * and SCIRun data management has the advantage that the Matlab side can be
65+ * further enhanced to deal with different future Matlab file formats , without
66+ * having to comb through the conversion code . Though there is a little
7167 * memory overhead. Especially with the V7 compressed files, more memory
72- * is needed to maintain the integrity of the matlab reader. Some changes
68+ * is needed to maintain the integrity of the Matlab reader. Some changes
7369 * in this converter may be needed to enhance performance. Currently the
7470 * a compressed file will be decompressed and scanned for suitable objects.
7571 * Upon loading the matrix, the matrix will be decompressed again as after
@@ -91,7 +87,7 @@ matlabconverter::matlabconverter() :
9187{
9288}
9389
94- matlabconverter::matlabconverter (SCIRun::ProgressReporter* pr) :
90+ matlabconverter::matlabconverter (LoggerHandle pr) :
9591 pr_(pr),
9692 numericarray_(false ),
9793 indexbase_(1 ),
@@ -123,8 +119,8 @@ unsigned int matlabconverter::convertmitype(matlabarray::mitype type)
123119}
124120
125121
126- // This function converts nrrds into matlab matrices
127- // only the datais being transformed into a matlab array
122+ // This function converts nrrds into Matlab matrices
123+ // only the datais being transformed into a Matlab array
128124
129125matlabarray::mitype matlabconverter::convertnrrdtype (int type)
130126{
@@ -145,7 +141,7 @@ matlabarray::mitype matlabconverter::convertnrrdtype(int type)
145141}
146142
147143// Support function to check whether the names supplied are within the
148- // rules that matlab allows. Otherwise we could save the file, but matlab
144+ // rules that Matlab allows. Otherwise we could save the file, but Matlab
149145// would complain it could not read the file.
150146
151147bool matlabconverter::isvalidmatrixname (std::string name)
@@ -626,7 +622,7 @@ void matlabconverter::mlArrayTOsciMatrix(matlabarray &ma,MatrixHandle &handle)
626622 // There is no transpose function to operate on the same memory block
627623 // Hence, it is a little memory inefficient.
628624
629- handle = dm.make_transpose (); // SCIRun has a C++-style matrix and matlab a FORTRAN-style matrix;
625+ handle = dm.make_transpose (); // SCIRun has a C++-style matrix and Matlab a FORTRAN-style matrix;
630626 }
631627 }
632628 break ;
@@ -650,7 +646,7 @@ void matlabconverter::mlArrayTOsciMatrix(matlabarray &ma,MatrixHandle &handle)
650646 const SparseRowMatrix::Storage& values = data.data ();
651647
652648 // NOTE: this was flipped around in the old code: the arrays rows/cols were passed as cols/rows into the SparseRowMatrix ctor. Hence the screwy order here, and the transpose call below.
653- // REASON: SCIRun uses Row sparse matrices and matlab Column sparse matrices.
649+ // REASON: SCIRun uses Row sparse matrices and Matlab Column sparse matrices.
654650 ma.getnumericarray (values.get (), nnz);
655651 ma.getrowsarray (cols.get (), nnz);
656652 ma.getcolsarray (rows.get (), (n+1 ));
@@ -916,7 +912,7 @@ int matlabconverter::sciNrrdDataCompatible(matlabarray &mlarray, std::string &in
916912void matlabconverter::mlArrayTOsciNrrdData (matlabarray &mlarray,NrrdDataHandle &scinrrd)
917913{
918914 // Depending on the matlabclass there are several converters
919- // for converting the data from matlab into a SCIRun Nrrd object
915+ // for converting the data from Matlab into a SCIRun Nrrd object
920916
921917 matlabarray::mlclass mclass;
922918 mclass = mlarray.getclass ();
@@ -943,7 +939,7 @@ void matlabconverter::mlArrayTOsciNrrdData(matlabarray &mlarray,NrrdDataHandle &
943939
944940 // obtain the type of the new nrrd
945941 // we want to keep the nrrd type the same
946- // as the original matlab type
942+ // as the original Matlab type
947943
948944 unsigned int nrrdtype = convertmitype (mlarray.gettype ());
949945
@@ -1402,14 +1398,14 @@ void matlabconverter::sciNrrdDataTOmlMatrix(NrrdDataHandle &scinrrd, matlabarray
14021398 // if there is no data leave the object empty
14031399 if (totsize == 0 ) return ;
14041400
1405- // we now have to determine the type of the matlab array
1401+ // we now have to determine the type of the Matlab array
14061402 // It can be either the same as in the nrrd array or casted
14071403 // to a more appropriate type
1408- // type will store the new matlab array type
1404+ // type will store the new Matlab array type
14091405
14101406 if (dataformat == matlabarray::miSAMEASDATA) dataformat = convertnrrdtype (nrrdptr->type );
14111407
1412- // create the matlab array structure
1408+ // create the Matlab array structure
14131409 mlarray.createdensearray (dims,dataformat);
14141410
14151411 // having the correct pointer type will automatically invoke
@@ -1645,7 +1641,7 @@ void matlabconverter::sciFieldTOmlArray(FieldHandle &scifield,matlabarray &mlarr
16451641 // Since the matlabconverter holds all our converter settings, we don't want to lose it, hence it is added
16461642 // here. The only disadvantage is that some of the functions in the matlabconverter class nedd to be public
16471643
1648- // create a new structured matlab array
1644+ // create a new structured Matlab array
16491645 mlarray.createstructarray ();
16501646
16511647 if (!(algo.execute (scifield,mlarray)))
@@ -1660,7 +1656,7 @@ void matlabconverter::sciFieldTOmlArray(FieldHandle &scifield,matlabarray &mlarr
16601656
16611657 if (mlarray.isempty ())
16621658 {
1663- // Apparently my sanity check did not work, we did not get a matlab object
1659+ // Apparently my sanity check did not work, we did not get a Matlab object
16641660 error (" Converter did not result in a useful translation, something went wrong, giving up." );
16651661 throw matlabconverter_error ();
16661662 }
@@ -1874,7 +1870,7 @@ void matlabconverter::sciBundleTOmlArray(BundleHandle &scibundle, matlabarray &m
18741870
18751871 // This routine scans systematically whether certain
18761872 // SCIRun objects are contained in the bundle and then
1877- // converts them into matlab objects
1873+ // converts them into Matlab objects
18781874
18791875 for (int p=0 ; p < numhandles; p++)
18801876 {
0 commit comments