- std::vector<double> signal;
- //...TODO, look for itk functions that can do that... vnl in the worst case.
- signal.push_back(1);signal.push_back(2);
-
- //TODO: instead: if the loaded signal is longer, just crop it...
- //this allows loading only the first few frames when testing.
- //->maybe raise a message that this behavior may be unsafe...
-
- //if compatible with the fused image sequence (number of images = number of entries), enable the temporalSync
- if ( signal.size() >= mSlicerManagers[index]->GetFusionSequenceNbFrames()) {
- //for convenience, associate this sequence to both the current slicer manager, and to the linked one
- mSlicerManagers[index]->SetFusionSequenceTemporalSignal(signal);
- mSlicerManagers[ mSlicerManagers[index]->GetFusionSequenceIndexOfLinkedManager() ]->SetFusionSequenceTemporalSignal(signal);
- overlayPanel->enableFusionSequenceTemporalSync();
- QMessageBox::information(this,tr("Adding signal"),"would add the signal from file: "+ fileName);
+ vnl_vector<double> tmpVect;
+
+ std::ifstream file;
+ file.open(fileName.toStdString().c_str());
+ tmpVect.read_ascii(file);
+ file.close();
+
+ //if compatible with the fused image sequence (number of entries = nb of entries in main sequence + nb of entries in joint sequence), enable the temporalSync
+ bool signalOK = true;
+ unsigned nbFrameMain = mSlicerManagers[index]->GetImage()->GetTransform().size();
+ unsigned nbFrameSecondary = mSlicerManagers[index]->GetFusionSequenceNbFrames();
+std::cout<<"nbFrameMain = "<<nbFrameMain<<", nbFrameSecondary= "<<nbFrameSecondary<<", signal size: "<<tmpVect.size()<<std::endl;
+ std::vector<unsigned> temporalCorrespondances;
+ if ( tmpVect.size() == nbFrameMain + nbFrameSecondary ) {
+ for (unsigned i=0 ; i<tmpVect.size() ; i++) {
+ if (i<nbFrameMain) { //first part of the file: i -> index in secondary seq.
+ if ( tmpVect(i)<nbFrameSecondary ) temporalCorrespondances.push_back(tmpVect(i));
+ else { signalOK=false; break; } //pointing outside the secondary sequence...
+ }
+ else { //first part of the file -> index in secondary seq.
+ if ( tmpVect(i)<nbFrameMain ) temporalCorrespondances.push_back(tmpVect(i));
+ else { signalOK=false; break; } //pointing outside the secondary sequence...
+ }
+ }