]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of /home/dsarrut/clitk3.server
authorDavid Sarrut <david.sarrut@gmail.com>
Fri, 18 Nov 2011 07:16:58 +0000 (08:16 +0100)
committerDavid Sarrut <david.sarrut@gmail.com>
Fri, 18 Nov 2011 07:16:58 +0000 (08:16 +0100)
common/clitkDicomRT_StructureSet.h
itk/clitkVectorBSplineDecompositionImageFilter.txx
itk/clitkVectorBSplineInterpolateImageFunctionWithLUT.h
itk/clitkVectorBSplineInterpolateImageFunctionWithLUT.txx
scripts/create_midP-2.0.sh
scripts/create_midP_masks-2.0.sh
vv/vv.cxx
vv/vvMainWindow.cxx
vv/vvMainWindow.h

index 5e4cf972d0a158284d4d5e721865bb0bef5eb016..d1cc37c2364b3451f9ad0b495b9de409a80c3425 100644 (file)
@@ -44,8 +44,8 @@ public:
   typedef itk::SmartPointer<Self> Pointer;
   itkNewMacro(Self);
 
-  typedef typename std::map<int, clitk::DicomRT_ROI::Pointer>::iterator ROIIteratorType;
-  typedef typename std::map<int, clitk::DicomRT_ROI::Pointer>::const_iterator ROIConstIteratorType;
+  typedef std::map<int, clitk::DicomRT_ROI::Pointer>::iterator ROIIteratorType;
+  typedef std::map<int, clitk::DicomRT_ROI::Pointer>::const_iterator ROIConstIteratorType;
 
   void Print(std::ostream & os = std::cout) const;
   void Read(const std::string & filename);
index 6161d22a8ff9e83390cc5bb4cd1a2b17c170062a..d64829ba09ac6c3cc87ac5eda11449ecfccd7484 100644 (file)
@@ -18,6 +18,7 @@
 #ifndef _clitkVectorBSplineDecompositionImageFilter_txx
 #define _clitkVectorBSplineDecompositionImageFilter_txx
 #include "clitkVectorBSplineDecompositionImageFilter.h"
+#include "clitkDD.h"
 #include "itkImageRegionConstIteratorWithIndex.h"
 #include "itkImageRegionIterator.h"
 #include "itkProgressReporter.h"
index 2b6d54d1776f686d130d39c7b43d5fc5027cfb1c..5bcbd8aff4f961d60c65bfbc8aed0b46cb5e6327 100644 (file)
@@ -84,6 +84,15 @@ namespace clitk {
     //void SetOutputSpacing(const SpacingType & s);
     //void SetInputImageIsCoefficient(bool inputIsCoef) { mInputIsCoef = inputIsCoef; }
 
+    /** Evaluate the function at a ContinuousIndex position.
+  Overwritten for taking LUT into account (RP: multi-threading-compatible version, 
+  the threadID is actually ignored) */  
+    virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType & index, unsigned int /* threadID */ ) const
+    {
+      std::cout << "EvaluateAtContinuousIndex" << std::endl;
+      return this->EvaluateAtContinuousIndex( index );
+    }
+
     /** Evaluate the function at a ContinuousIndex position.
        Overwritten for taking LUT into account */  
     virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType & index ) const;
index 8ea6e0ab09041fa78dec8878c96d74c762c5942f..4c66a2cb85fe0beb2210a25d641caeca364b2dc7 100644 (file)
@@ -245,7 +245,6 @@ typename VectorBSplineInterpolateImageFunctionWithLUT<TImageType,TCoordRep,TCoef
 VectorBSplineInterpolateImageFunctionWithLUT<TImageType,TCoordRep,TCoefficientType>::
 EvaluateAtContinuousIndex(const ContinuousIndexType & x) const
 {
-
     // JV Compute BSpline weights if not up to date! Problem const: pass image as last
     //  if (!mWeightsAreUpToDate) UpdatePrecomputedWeights();
   // For shorter coding
index 239745f5348c9daade6feefb3108ace546fea60a..a422e4f07e5ad713e62074a45b53553cb8e52b66 100755 (executable)
@@ -76,8 +76,14 @@ registration()
         registration_elastix $reference_out $target_out $mask_ref_out $mask_targ_out $vf_out $result_out $params $log_out
       fi
 
-      # combine in and out vf
       motion_mask=$mask_dir/mm_$phase_nb.mhd
+
+      # combine in and out results
+      out_result=$output_dir/result_${ref_phase_nb}_$phase_nb.mhd
+      clitkCombineImage -i $result_in -j $result_out -m $motion_mask -o $out_result
+      abort_on_error registration $? clean_up_registration
+
+      # combine in and out vf
       vf_result=$vf_dir/vf_${ref_phase_nb}_$phase_nb.mhd
       clitkCombineImage -i $vf_in -j $vf_out -m $motion_mask -o $vf_result
       abort_on_error registration $? clean_up_registration
@@ -103,6 +109,10 @@ registration()
   # create 4D vf
   create_mhd_4D_pattern.sh $vf_dir/vf_${ref_phase_nb}_
 
+  # create 4D result image
+  create_mhd_4D_pattern.sh $output_dir/result_inside_${ref_phase_nb}_
+  create_mhd_4D_pattern.sh $output_dir/result_${ref_phase_nb}_
+
   echo
   echo "-------- Registration done ! --------"
   end=`date`
index bbf44f0fa9a857da69581133681ddb046f715905..9f64694d8bcf96117de8e1ba0dd8d339a7b85877 100755 (executable)
@@ -130,7 +130,9 @@ mm_preprocessing()
   # extract_bones
   extract_lungs
   # remove_tmp_masks 1
-  resample
+  if [ $resample_spacing -ne 0 ] ; then 
+    resample
+  fi
 }
 
 mm_postprocessing()
@@ -143,9 +145,14 @@ mm_postprocessing()
 motion_mask()
 {
   #set cmd line variables
-  mhd4d=$1
-  resample_spacing=$2
-  resample_algo=$3
+  mhd4d=`basename $1`
+  if [ $# -eq 3 ] ; then
+    resample_spacing=$2
+    resample_algo=$3
+  else
+    resample_spacing=0
+    resample_algo=0
+  fi
 
   dir=`dirname $1`
   cd $dir
@@ -156,7 +163,11 @@ motion_mask()
   fi
 
   #set other global variables
-  mask_dir="MASK-${resample_spacing}mm-$resample_algo"
+  if [ $resample_spacing -ne 0 ] ; then
+    mask_dir="MASK-${resample_spacing}mm-$resample_algo"
+  else
+    mask_dir="MASK"
+  fi
   mask_dir_tmp="tmp.$mask_dir"
   extract_4d_phases $mhd4d
 
@@ -264,8 +275,8 @@ motion_mask()
 # main  #
 #################
 
-if [ $# != 3 ]; then
-  echo "Usage: $0 CT_4D RESAMPLE_SPACING RESAMPLE_ALGORITHM"
+if [ $# -ne 3 -a $# -ne 1 ]; then
+  echo "Usage: $0 CT_4D [RESAMPLE_SPACING RESAMPLE_ALGORITHM]"
   exit -1
 fi
 
@@ -276,5 +287,9 @@ fi
 #
 
 if [ $1 != "using-as-lib" ]; then
-  motion_mask $1 $2 $3
+  if [ $# -eq 3 ] ; then
+    motion_mask $1 $2 $3
+  else
+    motion_mask $1
+  fi
 fi
index 7f640a52a0579d660b251643a0357c8a7ad42327..1fb357e2419c7a082da57eaa7cd951c1417462ed 100644 (file)
--- a/vv/vv.cxx
+++ b/vv/vv.cxx
@@ -112,6 +112,7 @@ int main( int argc, char** argv )
   int n_image_loaded=0;
   std::string win(""), lev("");
 
+       bool link_images = false;
   if (argc >1) {
     for (int i = 1; i < argc; i++) {
       std::string current = argv[i];
@@ -144,7 +145,10 @@ int main( int argc, char** argv )
           parse_mode=P_WINDOW;
         } else if (current == "--level") {
           parse_mode=P_LEVEL;
-        } else if (current == "--log") {
+        } else if (current == "--linkall") {
+                                       link_images = true;
+                               }
+                               else if (current == "--log") {
           std::string log_dir = QDir::tempPath().toStdString() + std::string("/vv-log");
 
           if(itksys::SystemTools::FileExists(log_dir.c_str()) &&
@@ -204,6 +208,8 @@ int main( int argc, char** argv )
     window.ApplyWindowLevelToAllImages();
   }
 
+       if (link_images)
+               window.LinkAllImages();
 
   int ret = app.exec();
   
index 8884cbbb95bc3b040b4e093d80016ae84c5caf94..a7c61a997efa1a9b0527a56e3c73ed4b874855f4 100644 (file)
@@ -1720,11 +1720,16 @@ void vvMainWindow::SwitchWindowLevel()
 //------------------------------------------------------------------------------
 void vvMainWindow::ApplyWindowLevelToAllImages()
 {
+  int index = GetSlicerIndexFromItem(DataTree->selectedItems()[0]);
+  if(index==-1) return;
+  double window = mSlicerManagers[index]->GetColorWindow();
+  double level = mSlicerManagers[index]->GetColorLevel();
+
   for (unsigned int i = 0; i < mSlicerManagers.size(); i++) {
     if (mSlicerManagers[i] == NULL)
       continue;
-    mSlicerManagers[i]->SetColorWindow(windowSpinBox->value());
-    mSlicerManagers[i]->SetColorLevel(levelSpinBox->value());
+    mSlicerManagers[i]->SetColorWindow(window);
+    mSlicerManagers[i]->SetColorLevel(level);
     mSlicerManagers[i]->SetPreset(6);
     mSlicerManagers[i]->Render();
   }
@@ -2321,6 +2326,12 @@ void vvMainWindow::ReadSavedStateFile(const std::string& stateFile)
 }
 //------------------------------------------------------------------------------
 
+//------------------------------------------------------------------------------
+void vvMainWindow::LinkAllImages()
+{
+       linkPanel->linkAll();
+}
+
 //------------------------------------------------------------------------------
 void vvMainWindow::AddLink(QString image1,QString image2)
 {
@@ -2366,10 +2377,13 @@ void vvMainWindow::RemoveLink(QString image1,QString image2)
 //------------------------------------------------------------------------------
 void vvMainWindow::ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset)
 {
+  if(mSlicerManagers.size()==1)
+    return;
+
   int index = 0;
   while(sm != mSlicerManagers[index])
     index++;
-  index = (index+offset) % mSlicerManagers.size();
+  index = (index+offset+mSlicerManagers.size()) % mSlicerManagers.size();
 
   QTreeWidgetItem* item = GetItemFromSlicerManager(mSlicerManagers[index]);
   item->setData(slicer+1,Qt::CheckStateRole,2);         //change checkbox
@@ -2651,7 +2665,7 @@ void vvMainWindow::SaveScreenshotAllSlices()
                                                   "Images( *.png);;Images( *.jpg)");
 
   // Loop on slices
-  for(uint i=0; i<nbSlices; i++) {
+  for(int i=0; i<nbSlices; i++) {
     // Change the slice
     slicer->SetSlice(i); // -> change the slice of the current slicer
     SM->UpdateSlice(0); // --> this one emit UpdateSlice
index dfcbca6d40319fff99f8a23e1dd0edd5b6012240..12aaaf1a5f0b8d6f0d5a41d40f0d7bfe16092110 100644 (file)
@@ -63,6 +63,7 @@ class vvMainWindow: public vvMainWindowBase,
   void ShowLastImage();
   void SaveCurrentStateAs(const std::string& stateFile);
   void ReadSavedStateFile(const std::string& stateFile);
+       void LinkAllImages();
 
   virtual void UpdateCurrentSlicer();
   virtual QTabWidget * GetTab();