marRAW2AsciiFiles Class Reference

#include <marDicomBase.h>

Inheritance diagram for marRAW2AsciiFiles:
Inheritance graph
[legend]
Collaboration diagram for marRAW2AsciiFiles:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 marRAW2AsciiFiles (marParameters *p=NULL)
 ~marRAW2AsciiFiles ()
virtual bool loadImage (int i)
virtual void loadActualSerie (wxGauge *gauge)
void SetLittreEndianBigEndian (int value)
int GetLittreEndianBigEndian ()
void reset ()
void copyFrom (const marObject &from)
virtual void copyFrom (const marObject &from)=0
bool save (std::ofstream &os)
bool save (std::string &nw)
bool load (std::ifstream &is)
bool load (std::string &nr)
virtual wxString GetPatientName ()
kVolume * getVolume ()
void SetVolume (kVolume *volume)
bool volumeLoaded ()
void freeVolume ()
std::vector< std::string * > * GetListImages ()
void CleanListImages ()
void ResetLstFileNotReaded ()
std::string GetMsgLstFile ()
void setParameters (marParameters *p)
void copyParameters (marParameters *p)
void makeACopyParameters ()
marParametersgetParameters ()
bool parametersOwned ()

Protected Attributes

std::vector< std::string * > _lstString
std::vector< char * > _lstFileNotReaded

Detailed Description

Definition at line 92 of file marDicomBase.h.


Constructor & Destructor Documentation

marRAW2AsciiFiles::marRAW2AsciiFiles ( marParameters p = NULL  ) 

Definition at line 287 of file marDicomBase.cpp.

00288 :  marRAWFiles(p)
00289 {
00290 }

marRAW2AsciiFiles::~marRAW2AsciiFiles (  ) 

Definition at line 292 of file marDicomBase.cpp.

00293 {
00294 }


Member Function Documentation

void marFilesBase::CleanListImages (  )  [inherited]

Definition at line 45 of file marDicomBase.cpp.

References marFilesBase::_lstString.

Referenced by marRAW2Files::loadActualSerie(), loadActualSerie(), and marRAWFiles::loadActualSerie().

00046 {
00047         int i,size;
00048         size=this->_lstString.size();
00049         for(i=0;i<size;i++)
00050         {
00051                 delete _lstString[i];
00052         }
00053         _lstString.clear();
00054 }

Here is the caller graph for this function:

virtual void marObject::copyFrom ( const marObject from  )  [pure virtual, inherited]
void marRAWFiles::copyFrom ( const marObject from  )  [inherited]

Definition at line 269 of file marDicomBase.cpp.

00270 {
00271 }

void marObject::copyParameters ( marParameters p  )  [inherited]

Definition at line 42 of file marObject.cpp.

References marObject::_parameters, and marObject::_parametersCopied.

00043 {
00044     if( _parametersCopied && _parameters != NULL ) delete _parameters;
00045     _parameters = new marParameters( );
00046     *_parameters = *p;
00047     _parametersCopied = true;
00048 }

void marFilesBase::freeVolume (  )  [inherited]

Definition at line 31 of file marDicomBase.cpp.

References marFilesBase::_volume.

Referenced by InitExperiment_dll(), marRAW2Files::loadActualSerie(), loadActualSerie(), marRAWFiles::loadActualSerie(), and marFilesBase::~marFilesBase().

00031                               {
00032         if( _volume ) delete _volume;
00033         _volume = NULL;
00034 }

Here is the caller graph for this function:

std::vector< std::string * > * marFilesBase::GetListImages (  )  [inherited]

Definition at line 39 of file marDicomBase.cpp.

References marFilesBase::_lstString.

00040 {
00041         return &_lstString;
00042 }

int marRAWFiles::GetLittreEndianBigEndian (  )  [inherited]

Definition at line 260 of file marDicomBase.cpp.

References marRAWFiles::_littreEndianBigEndian.

00261 {
00262         return _littreEndianBigEndian;
00263 }

std::string marFilesBase::GetMsgLstFile (  )  [inherited]

Definition at line 65 of file marDicomBase.cpp.

References marFilesBase::_lstFileNotReaded.

Referenced by LoadRangeImage::ForceToFinisReadActiveImages().

00066 {
00067         int i,sizeLst;
00068 //EEDx44
00069         std::string msgLstFile="";
00070         sizeLst=_lstFileNotReaded.size();
00071         for (i=0;i<sizeLst;i++)
00072         {
00073                 msgLstFile = msgLstFile + *(_lstFileNotReaded[i]) ;
00074                 msgLstFile = msgLstFile + "\n";
00075         }
00076 
00077         return msgLstFile;
00078 }

Here is the caller graph for this function:

marParameters* marObject::getParameters (  )  [inline, inherited]
virtual wxString marFilesBase::GetPatientName (  )  [inline, virtual, inherited]

Definition at line 26 of file marDicomBase.h.

00026 {return _T(""); };

kVolume * marFilesBase::getVolume (  )  [inherited]
bool marObject::load ( std::string &  nr  )  [inherited]

Definition at line 67 of file marObject.cpp.

References marObject::load().

Referenced by marObject::load().

00068 {
00069     std::ifstream is( nr.c_str( ) );
00070 
00071     if( is ) {
00072 
00073         load( is );
00074         is.close( );
00075         return( true );
00076 
00077     } // fi
00078 
00079     return( false );
00080 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool marRAWFiles::load ( std::ifstream &  is  )  [virtual, inherited]

Implements marObject.

Definition at line 278 of file marDicomBase.cpp.

00279 {
00280         return true;
00281 }

void marRAW2AsciiFiles::loadActualSerie ( wxGauge *  gauge  )  [virtual]

Reimplemented from marRAWFiles.

Definition at line 304 of file marDicomBase.cpp.

References marFilesBase::_lstString, marFilesBase::CleanListImages(), marParameters::e_RescaleIntercept, marParameters::e_RescaleSlope, marParameters::e_voxel_x_dimension, marParameters::e_voxel_y_dimension, marParameters::e_voxel_z_dimension, marFilesBase::freeVolume(), marObject::getParameters(), marFilesBase::getVolume(), marParameters::setDoubleParam(), and marFilesBase::SetVolume().

00305 {
00306 
00307         // Read File List
00308         FILE *ff;
00309         ff = fopen( _lstString[0] -> c_str() , "r"); 
00310         char tmp[255];
00311 
00312         // type
00313         fscanf(ff,"%s",tmp);
00314         fscanf(ff,"%s",tmp);
00315         //int type =    atoi(tmp);  // 300  // JPRx
00316 
00317         //size x,y,z
00318         fscanf(ff,"%s",tmp);
00319         fscanf(ff,"%s",tmp);
00320         int wx  =       atoi(tmp);
00321         fscanf(ff,"%s",tmp);
00322         fscanf(ff,"%s",tmp);
00323         int wy  =       atoi(tmp);
00324         fscanf(ff,"%s",tmp);
00325         fscanf(ff,"%s",tmp);
00326         int wz  =       atoi(tmp);
00327 
00328         // spacing x,y,z
00329         fscanf(ff,"%s",tmp);
00330         fscanf(ff,"%s",tmp);
00331         double spx      =       atof(tmp);
00332         fscanf(ff,"%s",tmp);
00333         fscanf(ff,"%s",tmp);
00334         double spy      =       atof(tmp);
00335         fscanf(ff,"%s",tmp);
00336         fscanf(ff,"%s",tmp);
00337         double spz      =       atof(tmp);
00338 
00339         // Intercept Slope
00340         fscanf(ff,"%s",tmp);
00341         fscanf(ff,"%s",tmp);
00342         double intercept        =       atof(tmp);
00343         fscanf(ff,"%s",tmp);
00344         fscanf(ff,"%s",tmp);
00345         double slope            =       atof(tmp);
00346 
00347 
00348         fscanf(ff,"%s",tmp);
00349         std::string file(tmp);
00350         std::string namefile( *_lstString[1] );  // directory
00351         namefile=namefile+"/";                   // +  
00352         namefile=namefile+file;                  // file
00353 
00354         fclose(ff);
00355 
00356 
00357         this->CleanListImages();
00358 
00359         // Create Free Memory block image
00360         freeVolume();
00361 
00362         if (wz==0)
00363         {
00364                 wz=1;
00365         }
00366 
00367         kVolume *vol =new kVolume( kVolume::USHORT, wx, wy, wz,spx, spy, spz, malloc(sizeof(unsigned short)*wx*wy*wz ) );
00368         SetVolume( vol );
00369 
00370 
00371         // Define Spacing
00372         getParameters( )->setDoubleParam( marParameters::e_voxel_x_dimension, spx );
00373         getParameters( )->setDoubleParam( marParameters::e_voxel_y_dimension, spy );
00374         getParameters( )->setDoubleParam( marParameters::e_voxel_z_dimension, spz );
00375 
00376         // Define Intercept Slope
00377         getParameters( )->setDoubleParam( marParameters::e_RescaleIntercept , 0 );
00378         getParameters( )->setDoubleParam( marParameters::e_RescaleSlope     , 1 );
00379 
00380 
00381         void    *p_vol  = (void*)getVolume( )->castVtk()->GetScalarPointer(0,0,0);
00382         short   *pp             = (short*)p_vol;
00383 
00384         FILE *fff=fopen( (char*)namefile.c_str() , "r+" );
00385         long int ii, dataSize   = wx*wy*wz;
00386         float value;
00387         for (ii=0;ii<dataSize;ii++)
00388         {
00389                 fscanf(fff,"%f ",&value);
00390                 // Intercept Slope
00391                 *pp     = (short)        ( value*slope + intercept );
00392                 if (*pp<0)
00393                 {
00394                         *pp=0;
00395                 } 
00396                 pp++;
00397         }
00398         fclose(fff);
00399 
00400 
00401 // Y- Flip
00402 //      FlipY( getVolume( )->castVtk() );
00403         
00404 }

Here is the call graph for this function:

bool marRAW2AsciiFiles::loadImage ( int  i  )  [virtual]

Reimplemented from marRAWFiles.

Definition at line 296 of file marDicomBase.cpp.

00297 {
00298         return true;
00299 }

void marObject::makeACopyParameters (  )  [inline, inherited]

Definition at line 48 of file marObject.h.

00049     {
00050             copyParameters( _parameters );
00051     }

bool marObject::parametersOwned (  )  [inline, inherited]

Definition at line 56 of file marObject.h.

00056 { return( _parametersCopied ); };

void marRAWFiles::reset (  )  [virtual, inherited]

Virtual general methods (must be defined in each sub-class).

Implements marObject.

Definition at line 265 of file marDicomBase.cpp.

00266 {
00267 }

void marFilesBase::ResetLstFileNotReaded (  )  [inherited]

Definition at line 58 of file marDicomBase.cpp.

References marFilesBase::_lstFileNotReaded.

Referenced by LoadRangeImage::Start().

00059 {
00060         _lstFileNotReaded.clear();
00061 }

Here is the caller graph for this function:

bool marObject::save ( std::string &  nw  )  [inherited]

Persistence methods

Definition at line 51 of file marObject.cpp.

References marObject::save().

00052 {
00053     std::ofstream os( nw.c_str( ) );
00054 
00055     if( os ) {
00056 
00057         save( os );
00058         os.close( );
00059         return( true );
00060 
00061     } // fi
00062 
00063     return( false );
00064 }

Here is the call graph for this function:

bool marRAWFiles::save ( std::ofstream &  os  )  [virtual, inherited]

Virtual persistence methods (must be defined in each sub-class).

Implements marObject.

Definition at line 273 of file marDicomBase.cpp.

00274 {
00275         return true;
00276 }

void marRAWFiles::SetLittreEndianBigEndian ( int  value  )  [inherited]

Definition at line 255 of file marDicomBase.cpp.

References marRAWFiles::_littreEndianBigEndian.

Referenced by marRAWFiles::loadActualSerie().

00256 {
00257         _littreEndianBigEndian = value;
00258 }

Here is the caller graph for this function:

void marObject::setParameters ( marParameters p  )  [inherited]

Parameters assignation methods.

You can assign a marParameters object by reference (setParameters) or by value (copyParameters). Besides, if you want to make your actual reference to be by value, call makeACopyParameters.

Definition at line 34 of file marObject.cpp.

References marObject::_parameters, and marObject::_parametersCopied.

00035 {
00036     if( _parametersCopied && _parameters != NULL ) delete _parameters;
00037     _parameters = p;
00038     _parametersCopied = false;
00039 }

void marFilesBase::SetVolume ( kVolume *  volume  )  [inherited]

Definition at line 23 of file marDicomBase.cpp.

References marFilesBase::_volume.

Referenced by marRAW2Files::loadActualSerie(), loadActualSerie(), marRAWFiles::loadActualSerie(), marSimpleDicom::loadVolumeDXMM(), and wxMaracasFrame::OnStartExperiment().

00023                                               {
00024         _volume=volume;
00025 }

Here is the caller graph for this function:

bool marFilesBase::volumeLoaded (  )  [inherited]

Definition at line 27 of file marDicomBase.cpp.

References marFilesBase::_volume.

00027                                 {
00028         return( _volume != NULL );
00029 }


Member Data Documentation

std::vector< char*> marFilesBase::_lstFileNotReaded [protected, inherited]
std::vector< std::string*> marFilesBase::_lstString [protected, inherited]

The documentation for this class was generated from the following files:

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1