From: jean-pierre roux Date: Mon, 16 Nov 2009 12:47:12 +0000 (+0000) Subject: Add some comments X-Git-Tag: CREATOOLS.2-0-3~91 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=84809cf9be33368b919f46650048516db850aac0;p=creaImageIO.git Add some comments --- diff --git a/src2/creaImageIOGimmickView.cpp b/src2/creaImageIOGimmickView.cpp index c7e0cf1..e209d82 100644 --- a/src2/creaImageIOGimmickView.cpp +++ b/src2/creaImageIOGimmickView.cpp @@ -66,7 +66,7 @@ namespace creaImageIO // Anciently started the threads ... // Threads now automatically start at first image request //mReader.Start(); - + } //====================================================================== @@ -88,7 +88,7 @@ namespace creaImageIO mReaderStarted=false; } //====================================================================== - + //====================================================================== /// Finalize void GimmickView::Finalize() @@ -133,7 +133,7 @@ namespace creaImageIO GimmickError("INTERNAL ERROR : GimmickView::UpdateTreeView : '" <second->UpdateLevel(l); + i->second->UpdateLevel(l); } //====================================================================== @@ -148,7 +148,7 @@ namespace creaImageIO } //====================================================================== - + //====================================================================== bool ImageExtent::IsCompatible(const ImageExtent& ie) { @@ -163,7 +163,7 @@ namespace creaImageIO } //====================================================================== - + //====================================================================== void ImageExtent::Add(const ImageExtent& ie) { @@ -283,9 +283,22 @@ namespace creaImageIO ///Reads Images (Non Threaded) void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vector im, int dimension) { + +/* remember! + +#define GIMMICK_NO_IMAGE_SELECTION 0 +#define GIMMICK_2D_IMAGE_SELECTION 2 +#define GIMMICK_3D_IMAGE_SELECTION 3 +#define GIMMICK_4D_IMAGE_SELECTION 4 + +#define NATIVE 0 +#define _2D 2 +#define _3D 3 + +*/ // Create the output data if (im.size()==1) - { + { // Only one image : give it vtkImageData* out = vtkImageData::New(); GimmickDebugMessage(3, "State Check: Full Filename: " @@ -293,12 +306,12 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect <ShallowCopy(mReader.GetImage(im.front())); s.push_back( out ); - } + } else if (im.size()>1) // Test inutile ? JPR { vtkImageData* first = mReader.GetImage( im.front()); if (dimension == 2) - { + { // n3D std::vector::iterator it; for (it=im.begin(); it!=im.end(); ++it) @@ -310,18 +323,19 @@ void GimmickView::ReadImagesNotThreaded(std::vector& s, std::vect } else { - // n2D to 3D + // n*2D to 3D vtkImageData* out = vtkImageData::New(); out->CopyStructure(first); out->SetScalarType(first->GetScalarType()); int ext[6]; //first->GetExtent(ext); // JPR - first->GetWholeExtent(ext); + first->GetWholeExtent(ext); // renvoie egalement 0,0 en Z // JPR + std::cout <<"in GimmickView::ReadImagesNotThreaded GetWholeExtent ext ="; for (int jjj=0;jjj<6;jjj++) std:cout << " [" << jjj << "]=" << ext[jjj]; std::cout << endl; - + if(ext[5] == 0) { ext[5] = im.size()-1; @@ -331,6 +345,7 @@ std::cout << endl; ext[5] = ext[5] * im.size()-1; // to deal with multiframes - JPR } out->SetExtent(ext); + // LG : TODO : Z Spacing ? out->AllocateScalars(); @@ -341,7 +356,7 @@ std::cout << endl; int dim[3]; first->GetDimensions(dim); unsigned long imsize = dim[0] * dim[1]; - imsize = imsize * dim[2] ; // deal with multiframes// JPR + imsize = imsize * dim[2] ; // deal with multiframes // JPR //EED 03-11-2009 imsize = imsize * first->GetScalarSize(); @@ -353,7 +368,7 @@ std::cout << endl; vtkImageData* cur = mReader.GetImage( (*it)); // void* src = cur->GetScalarPointer(0,0,0); // void* dst = out->GetScalarPointer(0,0,slice); - memcpy(out->GetScalarPointer(0,0,slice),cur->GetScalarPointer(0,0,0),imsize); + memcpy(out->GetScalarPointer(0,0,slice), cur->GetScalarPointer(0,0,0), imsize); slice++; } diff --git a/src2/creaImageIOWxGimmickReaderDialog.cpp b/src2/creaImageIOWxGimmickReaderDialog.cpp index b2e38b5..c68efc1 100644 --- a/src2/creaImageIOWxGimmickReaderDialog.cpp +++ b/src2/creaImageIOWxGimmickReaderDialog.cpp @@ -10,14 +10,14 @@ namespace creaImageIO // CTor WxGimmickReaderDialog::WxGimmickReaderDialog(wxWindow *parent, wxWindowID id, - const std::string i_namedescp , - const std::string i_namedb , + const std::string i_namedescp, + const std::string i_namedb, wxString title, const wxPoint& pos, const wxSize& size, - int min_dim, + int min_dim, int max_dim, - int output_dim, + int output_dim, // never used ?!? // JPR int threads) : wxDialog( parent, id, @@ -25,10 +25,10 @@ namespace creaImageIO pos, size, wxRESIZE_BORDER | - wxSYSTEM_MENU | - wxCLOSE_BOX | - wxMAXIMIZE_BOX | - wxMINIMIZE_BOX | + wxSYSTEM_MENU | + wxCLOSE_BOX | + wxMAXIMIZE_BOX | + wxMINIMIZE_BOX | wxCAPTION ), // mGimmick(0), @@ -37,13 +37,12 @@ namespace creaImageIO GimmickDebugMessage(1,"WxGimmickReaderDialog::WxGimmickReaderDialog" <(new Gimmick()); + + mGimmick = boost::shared_ptr(new Gimmick()); mGimmick->Initialize(i_namedescp,i_namedb); - - + mView = new WxGimmickView(mGimmick, this, TVID, @@ -55,7 +54,7 @@ namespace creaImageIO mView->Initialize(); // Connect the AddProgress callback mView->ConnectValidationObserver - ( boost::bind( &WxGimmickReaderDialog::OnValid , this, _1 ) ); + ( boost::bind( &WxGimmickReaderDialog::OnValid , this, _1 ) ); } catch (crea::Exception e) { @@ -66,9 +65,9 @@ namespace creaImageIO topsizer->Add( mView,1,wxGROW,0); wxSizer* bsizer = CreateSeparatedButtonSizer(wxOK|wxCANCEL); - mOkButton = (wxButton*)FindWindowById(GetAffirmativeId(), this); - mCancelButton = (wxButton*)FindWindowById(GetEscapeId(), this); - + mOkButton = (wxButton*)FindWindowById(GetAffirmativeId(), this); + mCancelButton = (wxButton*)FindWindowById(GetEscapeId(), this); + mOkButton->Enable(false); topsizer->Add ( bsizer, 0, wxGROW ); @@ -84,8 +83,7 @@ namespace creaImageIO <Enable(t); } - + //================================================================ //BEGIN_EVENT_TABLE(WxGimmickReaderDialog, wxDialog) //END_EVENT_TABLE() //================================================================ - } // EO namespace creaImageIO - diff --git a/src2/creaImageIOWxGimmickReaderDialog.h b/src2/creaImageIOWxGimmickReaderDialog.h index 2572065..904b6cd 100644 --- a/src2/creaImageIOWxGimmickReaderDialog.h +++ b/src2/creaImageIOWxGimmickReaderDialog.h @@ -30,7 +30,7 @@ namespace creaImageIO int output_dim = NATIVE, int threads = 0); - boost::shared_ptr GetGimmick() { return mGimmick; } + boost::shared_ptr GetGimmick() { return mGimmick; } // typedef WxGimmick ViewType; typedef WxGimmickView::EventType EventType; @@ -59,7 +59,7 @@ namespace creaImageIO private : - boost::shared_ptr mGimmick; + boost::shared_ptr mGimmick; WxGimmickView* mView; wxButton* mOkButton; @@ -78,7 +78,6 @@ namespace creaImageIO } // EO namespace creaImageIO - #endif // USE_WIDGETS // EOF #endif