+++ /dev/null
-# - Find ROOT instalation
-# This module tries to find the ROOT installation on your system.
-# It tries to find the root-config script which gives you all the needed information.
-# If the system variable ROOTSYS is set this is straight forward.
-# If not the module uses the pathes given in ROOT_CONFIG_SEARCHPATH.
-# If you need an other path you should add this path to this varaible.
-# The root-config script is then used to detect basically everything else.
-# This module defines a number of key variables and macros.
-
-
-MESSAGE(STATUS "Looking for Root...")
-
-SET(ROOT_CONFIG_SEARCHPATH
- ${SIMPATH}/tools/root/bin
- $ENV{ROOTSYS}/bin
-)
-
-SET(ROOT_DEFINITIONS "")
-
-SET(ROOT_INSTALLED_VERSION_TOO_OLD FALSE)
-
-SET(ROOT_CONFIG_EXECUTABLE ROOT_CONFIG_EXECUTABLE-NOTFOUND)
-
-FIND_PROGRAM(ROOT_CONFIG_EXECUTABLE NAMES root-config PATHS
- ${ROOT_CONFIG_SEARCHPATH}
- NO_SYSTEM_ENVIRONMENT_PATH)
-
-IF (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
- MESSAGE( FATAL_ERROR "ROOT not installed in the searchpath and ROOTSYS is not set. Please
- set ROOTSYS or add the path to your ROOT installation in the Macro FindROOT.cmake in the
- subdirectory cmake/modules.")
-ELSE (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
- STRING(REGEX REPLACE "(^.*)/bin/root-config" "\\1" test ${ROOT_CONFIG_EXECUTABLE})
- SET( ENV{ROOTSYS} ${test})
- set( ROOTSYS ${test})
-ENDIF (${ROOT_CONFIG_EXECUTABLE} MATCHES "ROOT_CONFIG_EXECUTABLE-NOTFOUND")
-
-
-IF (ROOT_CONFIG_EXECUTABLE)
-
- SET(ROOT_FOUND FALSE)
-
- EXEC_PROGRAM(${ROOT_CONFIG_EXECUTABLE} ARGS "--version" OUTPUT_VARIABLE ROOTVERSION)
-
- MESSAGE(STATUS "Looking for Root... - found $ENV{ROOTSYS}/bin/root")
- MESSAGE(STATUS "Looking for Root... - version ${ROOTVERSION} ")
-
- # we need at least version 5.00/00
- IF (NOT ROOT_MIN_VERSION)
- SET(ROOT_MIN_VERSION "5.00/00")
- ENDIF (NOT ROOT_MIN_VERSION)
-
- # now parse the parts of the user given version string into variables
- STRING(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+" "\\1" req_root_major_vers "${ROOT_MIN_VERSION}")
- STRING(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" req_root_minor_vers "${ROOT_MIN_VERSION}")
- STRING(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+)" "\\1" req_root_patch_vers "${ROOT_MIN_VERSION}")
-
- # and now the version string given by qmake
- STRING(REGEX REPLACE "^([0-9]+)\\.[0-9][0-9]+\\/[0-9][0-9]+.*" "\\1" found_root_major_vers "${ROOTVERSION}")
- STRING(REGEX REPLACE "^[0-9]+\\.([0-9][0-9])+\\/[0-9][0-9]+.*" "\\1" found_root_minor_vers "${ROOTVERSION}")
- STRING(REGEX REPLACE "^[0-9]+\\.[0-9][0-9]+\\/([0-9][0-9]+).*" "\\1" found_root_patch_vers "${ROOTVERSION}")
-
- IF (found_root_major_vers LESS 5)
- MESSAGE( FATAL_ERROR "Invalid ROOT version \"${ROOTERSION}\", at least major version 4 is required, e.g. \"5.00/00\"")
- ENDIF (found_root_major_vers LESS 5)
-
- # compute an overall version number which can be compared at once
- MATH(EXPR req_vers "${req_root_major_vers}*10000 + ${req_root_minor_vers}*100 + ${req_root_patch_vers}")
- MATH(EXPR found_vers "${found_root_major_vers}*10000 + ${found_root_minor_vers}*100 + ${found_root_patch_vers}")
-
- IF (found_vers LESS req_vers)
- SET(ROOT_FOUND FALSE)
- SET(ROOT_INSTALLED_VERSION_TOO_OLD TRUE)
- ELSE (found_vers LESS req_vers)
- SET(ROOT_FOUND TRUE)
- ENDIF (found_vers LESS req_vers)
-
-ENDIF (ROOT_CONFIG_EXECUTABLE)
-
-
-IF (ROOT_FOUND)
-
- # ask root-config for the library dir
- # Set ROOT_LIBRARY_DIR
-
- EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
- ARGS "--libdir"
- OUTPUT_VARIABLE ROOT_LIBRARY_DIR_TMP )
-
- IF(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
- SET(ROOT_LIBRARY_DIR ${ROOT_LIBRARY_DIR_TMP} )
- ELSE(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
- MESSAGE("Warning: ROOT_CONFIG_EXECUTABLE reported ${ROOT_LIBRARY_DIR_TMP} as library path,")
- MESSAGE("Warning: but ${ROOT_LIBRARY_DIR_TMP} does NOT exist, ROOT must NOT be installed correctly.")
- ENDIF(EXISTS "${ROOT_LIBRARY_DIR_TMP}")
-
- # ask root-config for the binary dir
- EXEC_PROGRAM(${ROOT_CONFIG_EXECUTABLE}
- ARGS "--bindir"
- OUTPUT_VARIABLE root_bins )
- SET(ROOT_BINARY_DIR ${root_bins})
-
- # ask root-config for the include dir
- EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
- ARGS "--incdir"
- OUTPUT_VARIABLE root_headers )
- SET(ROOT_INCLUDE_DIR ${root_headers})
- # CACHE INTERNAL "")
-
- # ask root-config for the library varaibles
- EXEC_PROGRAM( ${ROOT_CONFIG_EXECUTABLE}
-# ARGS "--noldflags --noauxlibs --libs"
- ARGS "--glibs"
- OUTPUT_VARIABLE root_flags )
-
-# STRING(REGEX MATCHALL "([^ ])+" root_libs_all ${root_flags})
-# STRING(REGEX MATCHALL "-L([^ ])+" root_library ${root_flags})
-# REMOVE_FROM_LIST(root_flags "${root_libs_all}" "${root_library}")
-
- SET(ROOT_LIBRARIES ${root_flags})
-
- # Make variables changeble to the advanced user
- MARK_AS_ADVANCED( ROOT_LIBRARY_DIR ROOT_INCLUDE_DIR ROOT_DEFINITIONS)
-
- # Set ROOT_INCLUDES
- SET( ROOT_INCLUDES ${ROOT_INCLUDE_DIR})
-
- SET(LD_LIBRARY_PATH ${LD_LIBRARY_PATH} ${ROOT_LIBRARY_DIR})
-
- #######################################
- #
- # Check the executables of ROOT
- # ( rootcint )
- #
- #######################################
-
- FIND_PROGRAM(ROOT_CINT_EXECUTABLE
- NAMES rootcint
- PATHS ${ROOT_BINARY_DIR}
- NO_DEFAULT_PATH
- )
-
-ENDIF (ROOT_FOUND)
-
-
-
- ###########################################
- #
- # Macros for building ROOT dictionary
- #
- ###########################################
-
-MACRO (ROOT_GENERATE_DICTIONARY_OLD )
-
- set(INFILES "")
-
- foreach (_current_FILE ${ARGN})
-
- IF (${_current_FILE} MATCHES "^.*\\.h$")
- IF (${_current_FILE} MATCHES "^.*Link.*$")
- set(LINKDEF_FILE ${_current_FILE})
- ELSE (${_current_FILE} MATCHES "^.*Link.*$")
- set(INFILES ${INFILES} ${_current_FILE})
- ENDIF (${_current_FILE} MATCHES "^.*Link.*$")
- ELSE (${_current_FILE} MATCHES "^.*\\.h$")
- IF (${_current_FILE} MATCHES "^.*\\.cxx$")
- set(OUTFILE ${_current_FILE})
- ELSE (${_current_FILE} MATCHES "^.*\\.cxx$")
- set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE})
- ENDIF (${_current_FILE} MATCHES "^.*\\.cxx$")
- ENDIF (${_current_FILE} MATCHES "^.*\\.h$")
-
- endforeach (_current_FILE ${ARGN})
-
-# MESSAGE("INFILES: ${INFILES}")
-# MESSAGE("OutFILE: ${OUTFILE}")
-# MESSAGE("LINKDEF_FILE: ${LINKDEF_FILE}")
-# MESSAGE("INCLUDE_DIRS: ${INCLUDE_DIRS}")
-
- STRING(REGEX REPLACE "(^.*).cxx" "\\1.h" bla "${OUTFILE}")
-# MESSAGE("BLA: ${bla}")
- SET (OUTFILES ${OUTFILE} ${bla})
-
- ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES}
- COMMAND ${ROOT_CINT_EXECUTABLE}
- ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES})
-
-# MESSAGE("ROOT_CINT_EXECUTABLE has created the dictionary ${OUTFILE}")
-
-ENDMACRO (ROOT_GENERATE_DICTIONARY_OLD)
-
- ###########################################
- #
- # Macros for building ROOT dictionary
- #
- ###########################################
-
-MACRO (ROOT_GENERATE_DICTIONARY INFILES LINKDEF_FILE OUTFILE INCLUDE_DIRS_IN)
-
- set(INCLUDE_DIRS)
-
- foreach (_current_FILE ${INCLUDE_DIRS_IN})
- set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE})
- endforeach (_current_FILE ${INCLUDE_DIRS_IN})
-
-
-# MESSAGE("INFILES: ${INFILES}")
-# MESSAGE("OutFILE: ${OUTFILE}")
-# MESSAGE("LINKDEF_FILE: ${LINKDEF_FILE}")
-# MESSAGE("INCLUDE_DIRS: ${INCLUDE_DIRS}")
-
- STRING(REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" bla "${OUTFILE}")
-# MESSAGE("BLA: ${bla}")
- SET (OUTFILES ${OUTFILE} ${bla})
-
- ADD_CUSTOM_COMMAND(OUTPUT ${OUTFILES}
- COMMAND ${ROOT_CINT_EXECUTABLE}
- ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${INCLUDE_DIRS} ${INFILES} ${LINKDEF_FILE} DEPENDS ${INFILES})
-
-ENDMACRO (ROOT_GENERATE_DICTIONARY)
#include "clitkUSVoxImageIOFactory.h"
#include "clitkSvlImageIOFactory.h"
#endif
+#if ITK_VERSION_MAJOR >= 4
+ #include "itkGDCMImageIOFactory.h"
+#endif
//--------------------------------------------------------------------
// Register factories
void clitk::RegisterClitkFactories()
{
+#if ITK_VERSION_MAJOR >= 4
+ std::list< itk::ObjectFactoryBase * > fl = itk::GDCMImageIOFactory::GetRegisteredFactories();
+ for (std::list< itk::ObjectFactoryBase * >::iterator it = fl.begin(); it != fl.end(); ++it)
+ if (dynamic_cast<itk::GDCMImageIOFactory *>(*it))
+ {
+ itk::GDCMImageIOFactory::UnRegisterFactory(*it);
+ break;
+ }
+#endif
#if CLITK_PRIVATE_FEATURES
clitk::UsfImageIOFactory::RegisterOneFactory();
clitk::USVoxImageIOFactory::RegisterOneFactory();
rtk::EdfImageIOFactory::RegisterOneFactory();
rtk::ImagXImageIOFactory::RegisterOneFactory();
clitk::EsrfHstImageIOFactory::RegisterOneFactory();
+#if ITK_VERSION_MAJOR >= 4
+ itk::GDCMImageIOFactory::RegisterOneFactory();
+#endif
} ////
section "Input"
-option "input" i "Input grid filename" string yes
-option "output" o "Output grid filename" string yes
+option "input" i "Input image filename" string yes
+option "output" o "Output image filename" string yes
section "Processing Parameters"
--- /dev/null
+/*=========================================================================
+ Program: vv http://www.creatis.insa-lyon.fr/rio/vv
+
+ Authors belong to:
+ - University of LYON http://www.universite-lyon.fr/
+ - Léon Bérard cancer center http://www.centreleonberard.fr
+ - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the copyright notices for more information.
+
+ It is distributed under dual licence
+
+ - BSD See included LICENSE.txt file
+ - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+===========================================================================*/
+#include "clitkMaskLandmarks_ggo.h"
+
+#include <string>
+#include <vector>
+#include <iostream>
+#include <fstream>
+
+#include <clitkCommon.h>
+#include <clitkImageCommon.h>
+
+typedef itk::Point<double, 3> PointType;
+typedef std::vector<PointType> PointArrayType;
+
+static void read_points_pts(const std::string& fileName, PointArrayType& points, bool verbose)
+{
+ std::ifstream landmarksFile(fileName.c_str());
+ if (landmarksFile.fail())
+ {
+ std::cerr << "ERROR: could not open '" << fileName << "'" << std::endl;
+ exit(-2);
+ }
+
+ std::string line;
+ std::getline(landmarksFile, line);
+ if (line.find("#X") != 0)
+ {
+ std::cerr << "ERROR: invalid landmarks file '" << fileName << "'" << std::endl;
+ exit(-3);
+ }
+
+ PointType p;
+ while (!landmarksFile.eof())
+ {
+ landmarksFile >> p[0] >> p[1] >> p[2];
+ if (landmarksFile.fail())
+ break;
+ if (verbose)
+ std::cout << "point " << p << std::endl;
+ points.push_back(p);
+ }
+}
+
+void write_points_pts(const std::string& fileName, const PointArrayType& points, bool verbose)
+{
+ std::ofstream landmarksFile(fileName.c_str());
+
+ landmarksFile << "#X\tY\tZ" << std::endl;
+ for (size_t i = 0; i < points.size(); i++)
+ landmarksFile << points[i][0] << "\t" << points[i][1] << "\t" << points[i][2] << "\t" << std::endl;
+}
+
+int main(int argc, char** argv)
+{
+ typedef itk::Image<unsigned char, 3> MaskType;
+ typedef MaskType::Pointer MaskPointer;
+ GGO(clitkMaskLandmarks, args_info);
+
+ if (args_info.input_given != args_info.output_given)
+ {
+ std::cerr << "The number of inputs must be equal to the number of outputs" << std::endl;;
+ exit(1);
+ }
+
+ std::vector<PointArrayType> inputs(args_info.input_given);
+ for (unsigned i = 0; i < args_info.input_given; ++i)
+ {
+ read_points_pts(args_info.input_arg[i], inputs[i], args_info.verbose_flag);
+ if (inputs[i].size() != inputs[0].size())
+ {
+ std::cerr << "All input files must contain the same amount of points" << std::endl;
+ exit(2);
+ }
+ }
+
+ MaskPointer mask = clitk::readImage<MaskType>(args_info.mask_arg, args_info.verbose_flag);
+ std::vector<PointArrayType> outputs(args_info.input_given);
+ for (unsigned i = 0; i < inputs[0].size(); ++i)
+ {
+ MaskType::IndexType idx;
+ if (mask->TransformPhysicalPointToIndex(inputs[0][i], idx) && (*mask)[idx])
+ for (unsigned j = 0; j < args_info.input_given; j++)
+ outputs[j].push_back(inputs[j][i]);
+ }
+
+ for (unsigned i = 0; i < args_info.input_given; ++i)
+ write_points_pts(args_info.output_arg[i], outputs[i], args_info.verbose_flag);
+}
--- /dev/null
+package "clitkMaskLandmarks"
+version "1.0"
+purpose "Remove landmarks outside of a given mask also remove their corresponding points if multiple input are given."
+
+option "config" - "Config file" string no
+option "verbose" v "Verbose" flag off
+
+option "input" i "Input landmarks filename" string yes multiple
+option "mask" m "Input mask" string yes
+option "output" o "Output landmarks filename" string yes multiple
option "output" o "Output image filename" string yes
section "Used determined padding"
-option "lower" l "Size of the lower crop region (multiple values)" int no multiple
-option "upper" u "Size of the upper crop region (multiple values)" int no multiple
+option "lower" l "Size of the lower bound padding (multiple values=number of image dimension)" int no multiple
+option "upper" u "Size of the upper bound padding (multiple values=number of image dimension)" int no multiple
+
section "Pad like another image"
option "like" - "Pad like this image (must have the same spacing and bounding box must be larger)" string no
<rect>
<x>0</x>
<y>0</y>
- <width>444</width>
- <height>612</height>
+ <width>446</width>
+ <height>679</height>
</rect>
</property>
<property name="sizePolicy">
</property>
<property name="geometry">
<rect>
- <x>220</x>
+ <x>230</x>
<y>60</y>
- <width>80</width>
+ <width>91</width>
<height>17</height>
</rect>
</property>
<widget class="QCheckBox" name="fCTUSActivateSpaceSyncCheckBox">
<property name="geometry">
<rect>
- <x>220</x>
+ <x>270</x>
<y>10</y>
- <width>61</width>
+ <width>81</width>
<height>17</height>
</rect>
</property>
<rect>
<x>30</x>
<y>0</y>
- <width>171</width>
+ <width>231</width>
<height>32</height>
</rect>
</property>
<rect>
<x>130</x>
<y>36</y>
- <width>151</width>
+ <width>201</width>
<height>20</height>
</rect>
</property>
<enum>Qt::Horizontal</enum>
</property>
</widget>
- <widget class="QPushButton" name="fCTUSLoadSignalPushButton">
+ <widget class="QPushButton" name="fCTUSLoadCorrespondancesPushButton">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
- <width>131</width>
+ <width>171</width>
<height>23</height>
</rect>
</property>
+ <property name="toolTip">
+ <string><html><head/><body><p>Load a file indicating the correspondances between time indices between both sequences.</p><p>The format needs to be the following:</p><p>let nt1 the number of frames in sequence 1, resp. nt2 and seq. 2 </p><p>The file must contain nt1 + nt2 entries.</p><p>entry i (i&lt;=nt1) indicates for the i-th frame of sequence 1 the index to display for sequence 2.</p><p>resp. i&gt;nt1 indicate corresp from seq. 2 to seq. 1</p></body></html></string>
+ </property>
<property name="text">
- <string>Load Fused Seq. Signal</string>
+ <string>Load Correspondances</string>
</property>
</widget>
</widget>
// Standard includes
#include <iostream>
+#include <fstream>
#include <sstream>
#include <iomanip>
#define COLUMN_IMAGE_NAME 7
#ifdef CLITK_PRIVATE_FEATURES
-#define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz *.usf)"
+#define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz *.usf *.svl)"
#else
#define EXTENSIONS "Images ( *.bmp *.png *.jpeg *.jpg *.tif *.mhd *.mha *.hdr *.vox *.his *.xdr *.SCAN *.nii *.nrrd *.nhdr *.refscan *.nii.gz)"
#endif
connect(actionDocumentation,SIGNAL(triggered()),this,SLOT(ShowDocumentation()));
connect(actionRegister_vv,SIGNAL(triggered()),this,SLOT(PopupRegisterForm()));
- connect(overlayPanel, SIGNAL(FusionSequenceSignalButtonPressed()), this, SLOT(SelectFusionSequenceTemporalSignal()));
+ connect(overlayPanel, SIGNAL(FusionSequenceCorrespondancesButtonPressed()), this, SLOT(SelectFusionSequenceCorrespondances()));
///////////////////////////////////////////////
}
//TODO: also remove the image overlaid with the main sequence, as it is becoming invalid...
+ //this shall be done by calling this->CloseImage() with the correct index;...
}
linkPanel->removeImage(index);
//------------------------------------------------------------------------------
-void vvMainWindow::SelectFusionSequenceTemporalSignal() {
+void vvMainWindow::SelectFusionSequenceCorrespondances() {
//make sure the index is right?
//in the end, I should attach the temporal data to the right sequence!
}
//open a dialog box to find a file
- QString Extensions = EXTENSIONS;
- Extensions += ";;All Files (*)";
+ //QString Extensions = EXTENSIONS;
+ QString Extensions = ";;All Files (*)";
QString fileName = QFileDialog::getOpenFileName(this,tr("Load respiratory signal for fused sequence"),mInputPathName,Extensions);
if (fileName.isNull())
return;
//read it as a vector of values
- 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::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...
+ }
+ }
}
- else {//else, send a message to signal the failure...
- QString error = "The provided signal doesn't have the same duration as the sequence\n";
+ else {signalOK=false;}
+ if (!signalOK) {//else, send a message to signal the failure...
+ QString error = "The provided temporal correspondances is invalid - check tooltip.\n";
error += "Ignoring file: " + fileName;
- QMessageBox::information(this,tr("Problem adding signal!"),error);
+ QMessageBox::information(this,tr("Problem adding temporal correspondances!"),error);
return;
}
+ else {
+ //for convenience, associate this sequence to both the current slicer manager, and to the linked one
+ mSlicerManagers[index]->SetFusionSequenceCorrespondances(temporalCorrespondances);
+ mSlicerManagers[ mSlicerManagers[index]->GetFusionSequenceIndexOfLinkedManager() ]->SetFusionSequenceCorrespondances(temporalCorrespondances);
+ overlayPanel->enableFusionSequenceTemporalSync();
+ }
}
//------------------------------------------------------------------------------
if (spatialSyncFlag) { //reslice the CT
if (temporalSyncFlag) { //do the temporal synchronisation
- //TODO: add the temporal synchronisation stuff
- //if the button is checked, get the phase of the requested US frame from the available signal
- //and select the corresponding one in the CT. (check the one just before, and the one just after, and select the closest)
-
- //TODO: do it also the other way around, when modifying the time index related to CT, select a close frame
- //this should not be done here directly, but the code should be inspired from the one here
- //->find a good US frame such that when calling this function with this US frame, it produces the expected result
-
-
- //TODO: select the right CT image to display
int mainSequenceFrameIndex=0;
//estimate the TSlice to set to the CT
-
+ unsigned nbFramesMain = mSlicerManagers[index]->GetImage()->GetTransform().size();
+ mainSequenceFrameIndex = mSlicerManagers[index]->GetFusionSequenceCorrespondances()[ nbFramesMain + fusionSequenceFrameIndex];
//and set it!
mSlicerManagers[index]->SetTSlice(mainSequenceFrameIndex, false);
+ //warning, there is a loopback, and modification of the TSlice in main sequence forces an update of the TSlice in secondary, etc...
}
if (mSlicerManagers[i]->GetFusionSequenceTemporalSyncFlag()) {
//WARNING: for some obscure reason, there are problems when accessing mSlicerManagers[mSlicerManagers[i]->GetFusionSequenceIndexOfLinkedManager()]->GetFusionSequenceFrameIndex();
- //int estimatedValue=mSlicerManagers[mSlicerManagers[i]->GetFusionSequenceIndexOfLinkedManager()]->GetFusionSequenceFrameIndex();
int estimatedValue=0;
- //TODO: if temporal sync is active
//estimate a corresponding time index for the secondary (US) sequence, and update it accordingly.
- //estimatedValue = ...
- overlayPanel->updateFusionSequenceSliderValueFromWindow(estimatedValue, true);
+ estimatedValue = mSlicerManagers[i]->GetFusionSequenceCorrespondances()[ value ];
+ //TODO: at the moment, there is a loop in TSlice modifications
+ //modifying sequence 1 causes seq 2 to update, which in turns update seq1...
+ //I disable control on seq1 at the moment.
+ //overlayPanel->updateFusionSequenceSliderValueFromWindow(estimatedValue, true);
}
}
}
void SelectFusionImage();
//select the file(s) from the disk containing the image sequence to fuse
void SelectFusionSequence();
- void SelectFusionSequenceTemporalSignal();
+ void SelectFusionSequenceCorrespondances();
void ResetTransformationToIdentity();
connect(fCTUSSlider,SIGNAL(valueChanged(int)),this,SLOT(setFusionSequenceProperty()));
connect(fCTUSActivateSpaceSyncCheckBox,SIGNAL(stateChanged(int)),this,SLOT(setFusionSequenceProperty()));
connect(fCTUSActivateTimeSyncCheckBox,SIGNAL(stateChanged(int)),this,SLOT(setFusionSequenceProperty()));
- connect(fCTUSLoadSignalPushButton,SIGNAL(clicked()),this,SIGNAL(FusionSequenceSignalButtonPressed()));
+ connect(fCTUSLoadCorrespondancesPushButton,SIGNAL(clicked()),this,SIGNAL(FusionSequenceCorrespondancesButtonPressed()));
}
void vvOverlayPanel::getCurrentImageName(QString name)
void OverlayPropertyUpdated(int color, int linked, double window, double level);
void FusionPropertyUpdated(int opacity, int thresOpacity, int colormap, double window, double level, bool showLegend);
void FusionSequencePropertyUpdated(int sequenceFrameIndex, bool spatialSync, unsigned int sequenceLength, bool temporalSync);
- void FusionSequenceSignalButtonPressed();
+ void FusionSequenceCorrespondancesButtonPressed();
private:
bool disableFusionSignals;
mFusionSequenceListInitialTransformMatrices.push_back( tmpMat );
}
void SetFusionSequenceIndexOfLinkedManager(int index) { mFusionSequenceIndexLinkedManager = index; }
- void SetFusionSequenceTemporalSignal(std::vector<double> s) { mFusionSequenceTemporalSignal = s; }
+ void SetFusionSequenceCorrespondances(std::vector<unsigned> s) { mFusionSequenceCorrespondances = s; }
void SetFusionSequenceInvolvmentCode(int code) { mFusionSequenceInvolvementCode=code; }
int GetFusionSequenceInvolvmentCode() { return mFusionSequenceInvolvementCode;}
const vtkSmartPointer<vtkMatrix4x4>& GetFusionSequenceInitialTransformMatrixAtFrame(unsigned i) {
return mFusionSequenceListInitialTransformMatrices[i];
}
- const std::vector<double>& GetFusionSequenceTemporalSignal() {return mFusionSequenceTemporalSignal;}
+ const std::vector<unsigned>& GetFusionSequenceCorrespondances() {return mFusionSequenceCorrespondances;}
double GetColorWindow() const;
double GetColorLevel() const;
bool mFusionSequenceSpatialSyncFlag, mFusionSequenceTemporalSyncFlag; //flags indicating whether the spatial/temporal synchronization are actives
vtkSmartPointer<vtkMatrix4x4> mFusionSequenceMainTransform;
std::vector< vtkSmartPointer<vtkMatrix4x4> > mFusionSequenceListInitialTransformMatrices;
- std::vector<double> mFusionSequenceTemporalSignal;
+ std::vector<unsigned> mFusionSequenceCorrespondances;
int mPreset;
SlicingPresetType mSlicingPreset;