]> Creatis software - clitk.git/commitdiff
Merge branch 'master' of git.creatis.insa-lyon.fr:clitk
authorrblanc <rblanc33@gmail.com>
Tue, 2 Apr 2013 14:34:41 +0000 (16:34 +0200)
committerrblanc <rblanc33@gmail.com>
Tue, 2 Apr 2013 14:34:41 +0000 (16:34 +0200)
48 files changed:
cmake/dependencies.cmake
common/CMakeLists.txt
common/clitkCommon.h
common/clitkCommon.txx
common/clitkDicomRTDoseIO.cxx
common/clitkEsrfHstImageIO.cxx
common/clitkFilterBase.cxx
common/clitkFilterBase.h
common/clitkIO.cxx
common/rtkXRadImageIO.cxx [new file with mode: 0644]
common/rtkXRadImageIO.h [new file with mode: 0644]
common/rtkXRadImageIOFactory.cxx [new file with mode: 0644]
common/rtkXRadImageIOFactory.h [new file with mode: 0644]
common/vvImage.cxx
common/vvImage.h
common/vvImage.txx
itk/clitkAddRelativePositionConstraintToLabelImageFilter.h
itk/clitkAddRelativePositionConstraintToLabelImageFilter.txx
itk/clitkExtractSliceFilter.txx
itk/clitkLabelImageOverlapMeasureFilter.txx
itk/clitkSegmentationUtils.h
itk/clitkSegmentationUtils.txx
itk/clitkSliceBySliceRelativePositionFilter.h
itk/clitkSliceBySliceRelativePositionFilter.txx
registration/CMakeLists.txt
segmentation/CMakeLists.txt
segmentation/clitkConnectedComponentLabelingGenericFilter.txx
segmentation/clitkExtractPatientGenericFilter.txx
segmentation/clitkRelativePositionList.txx
segmentation/clitkSliceBySliceRelativePositionFilter_uchar.cxx [new file with mode: 0644]
superbuild/CMakeLists.txt
tools/CMakeLists.txt
tools/clitkAffineTransformGenericFilter.txx
tools/clitkAutoCropGenericFilter.txx
tools/clitkBinarizeImage.ggo
tools/clitkImageArithm.cxx
tools/clitkImageArithm.ggo
tools/clitkImageArithmGenericFilter.txx
tools/clitkImageStatisticsGenericFilter.txx
vv/CMakeLists.txt
vv/qt_ui/vvInfoPanel.ui
vv/qt_ui/vvMainWindow.ui
vv/vvBinaryImageOverlayActor.cxx
vv/vvInfoPanel.cxx
vv/vvInfoPanel.h
vv/vvMainWindow.cxx
vv/vvSlicer.cxx
vv/vvSlicer.h

index 065469736579253f50c44b57c55730da2d518617..4396d093127c0ee6016ff35c72a67ff288097d85 100644 (file)
@@ -44,11 +44,13 @@ FIND_PACKAGE(Gengetopt)
 
 #=========================================================
 # Find libstatgrab is installed, add clitkMemoryUsage.cxx in the library
-FIND_LIBRARY(LIBSTATGRAB NAMES statgrab PATHS)
-IF (${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
+IF (NOT DEFINED CLITK_MEMORY_INFO OR CLITK_MEMORY_INFO)
+  FIND_LIBRARY(LIBSTATGRAB NAMES statgrab PATHS)
+  IF (${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
 #  MESSAGE("Install libstatgrab (http://www.i-scream.org/libstatgrab/) for memory usage information")
-  SET(CLITK_MEMORY_INFO OFF)
-ELSE (${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
-  SET(CLITK_MEMORY_INFO ON)
-ENDIF (${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")  
+    SET(CLITK_MEMORY_INFO OFF)
+  ELSE (${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
+    SET(CLITK_MEMORY_INFO ON)
+  ENDIF (${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")  
+ENDIF()
 #=========================================================
index 3c7a5803ed801494be97bbb0580604cb7d42a50a..cd6af5b41b3066f07fd7109e8a536efe1a431930 100644 (file)
@@ -24,6 +24,8 @@ SET(clitkCommon_SRC
   rtkHndImageIOFactory.cxx
   rtkEdfImageIO.cxx
   rtkEdfImageIOFactory.cxx
+  rtkXRadImageIO.cxx
+  rtkXRadImageIOFactory.cxx
   rtkImagXImageIO.cxx
   rtkImagXImageIOFactory.cxx
   rtkImagXXMLFileReader.cxx
@@ -55,9 +57,9 @@ ENDIF(CLITK_PRIVATE_FEATURES)
 ### Declare clitkCommon library
 ADD_LIBRARY(clitkCommon STATIC ${clitkCommon_SRC})
 
-IF(NOT ${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
+IF(CLITK_MEMORY_INFO)
   TARGET_LINK_LIBRARIES(clitkCommon statgrab)
-ENDIF(NOT ${LIBSTATGRAB} MATCHES "LIBSTATGRAB-NOTFOUND")
+ENDIF(CLITK_MEMORY_INFO)
 
 ### Check if ITK was compiled with SYSTEM_GDCM = ON and set the gdcm libraries accordingly
 SET(CLITK_USE_SYSTEM_GDCM FALSE)
index 8f9ce0f0ee20fb8ad45b48f38876fc3d993695c5..8cd82fbe0b0bc1b20f38876368f0d6348615b1a9 100644 (file)
@@ -235,6 +235,11 @@ namespace clitk {
   template <typename M, typename V> 
   void MapToVecSecond(const M & m, V & v);
 
+  //--------------------------------------------------------------------
+  // Find/replace string
+  template<class T>
+  int inline findAndReplace(T& source, const T& find, const T& replace);
+
 #include "clitkCommon.txx"
 
 } // end namespace
index 5ee83bdca8f4f3efc23ae2aa8dc12ad28a2fe36e..845e62fe520deb89def17b26d99c0e3fa7be1c98 100644 (file)
@@ -235,5 +235,22 @@ void MapToVecSecond(const  M & m, V & v) {
 }
 //--------------------------------------------------------------------
 
+
+//--------------------------------------------------------------------
+//http://stackoverflow.com/questions/1494399/how-do-i-search-find-and-replace-in-a-standard-string
+template<class T>
+int inline findAndReplace(T& source, const T& find, const T& replace)
+{
+  int num=0;
+  int fLen = find.size();
+  int rLen = replace.size();
+  for (int pos=0; (pos=source.find(find, pos))!=T::npos; pos+=rLen) {
+    num++;
+    source.replace(pos, fLen, replace);
+  }
+  return num;
+}
+//--------------------------------------------------------------------
+
 #endif /* end #define CLITKCOMMON_TXX */
 
index 960cb1d72cb2a50f8905fd62b79d4abefafe7a20..88e1289351a2badbd15979a7e634aa9849192ed9 100644 (file)
@@ -281,10 +281,28 @@ void clitk::DicomRTDoseIO::Read(void * buffer)
   /* PixelData */
 #if GDCM_MAJOR_VERSION == 2
   gdcm::Image &i = m_GdcmImageReader.GetImage();
-  i.GetBuffer((char*)buffer);
-  // WARNING: GetBuffer return the pixel values as stored on disk not the real pixel value
-  // we still need to multiply by m_DoseScaling
-  // An alternate solution would be to use vtkGDCMImageReader...
+  
+  char* image_data = new char[i.GetBufferLength()];
+  i.GetBuffer(image_data);
+
+  gdcm::DataSet& ds = m_GdcmImageReader.GetFile().GetDataSet();
+  float *img = (float*) buffer;
+  
+  gdcm::Attribute<0x28, 0x100> pixel_size;
+  pixel_size.SetFromDataSet(ds);
+  if (pixel_size.GetValue() == 16)  {
+    unsigned short* image_data2 = (unsigned short*) image_data ;
+    dose_copy_raw (img, image_data2, npix, m_DoseScaling);
+  }
+  else if (pixel_size.GetValue() == 32)  {
+    unsigned long* image_data2 = (unsigned long*) image_data;
+    dose_copy_raw (img, image_data2, npix, m_DoseScaling);
+  } else {
+    itkExceptionMacro(<< "Error RTDOSE not type 16U and 32U (type="
+                      << pixel_size.GetValue() << ")");
+  }
+  
+  delete [] image_data;
 #else
   float *img = (float*) buffer;
 
index 8023ddd62d5aff56046c7fa26c9b4b2a45007ca6..e9b8fdf3ed6227a14670706c91bcf21f3b3fbe23 100644 (file)
@@ -79,7 +79,7 @@ bool clitk::EsrfHstImageIO::CanReadFile(const char* FileNameToRead)
 
   std::string firstLine;
   std::getline(is, firstLine);
-  if(firstLine != std::string("<!-- PyHST VOLUME XML FILE -->") )
+  if(firstLine.find( std::string("<!-- PyHST VOLUME XML FILE -->") ) == std::string::npos)
     return false;
 
   return true;
index 32dd9b46cfbeb49fe75cf1e87097f729a9f3d213..f6bebad101072e7d8ed40fe62b710f962e802f1f 100644 (file)
@@ -49,7 +49,7 @@ void clitk::FilterBase::SetWarning(std::string e)
 
 
 //--------------------------------------------------------------------
-void clitk::FilterBase::StartNewStep(std::string s) 
+void clitk::FilterBase::StartNewStep(std::string s, bool endl
 {
   if (Cancelled()) {
     throw clitk::ExceptionObject("Filter is canceled.");
@@ -69,7 +69,8 @@ void clitk::FilterBase::StartNewStep(std::string s)
 
   m_CurrentStepName = "Step "+GetCurrentStepId()+" -- "+s;
   if (GetVerboseStepFlag()) {
-    std::cout << m_CurrentStepName << std::endl;
+    std::cout << m_CurrentStepName;
+    if (endl) std::cout << std::endl;
     //"Step " << GetCurrentStepId() << " -- " << s << std::endl;
   }
 }
index b05f64d24b81b97be443fd0f4e2ee1686b4978c4..7403f37fe0a041fa6a1b0ea85c696b65e1a302f7 100644 (file)
@@ -118,7 +118,7 @@ namespace clitk {
   protected:
     FilterBase();
     virtual ~FilterBase() {}    
-    void StartNewStep(std::string s);
+    void StartNewStep(std::string s, bool endl=true);
     template<class TInternalImageType>
     void StopCurrentStep(typename TInternalImageType::Pointer p, std::string txt="");
     void StopCurrentStep();
index 07af298b5563c35cbe99d62c1f30edf7fd4bf81f..5c5977baa4fb7326da551a662a1ab44c1cf35459 100644 (file)
@@ -34,6 +34,7 @@
 #include "rtkHndImageIOFactory.h"
 #include "rtkEdfImageIOFactory.h"
 #include "rtkImagXImageIOFactory.h"
+#include "rtkXRadImageIOFactory.h"
 #include "clitkEsrfHstImageIOFactory.h"
 #include "clitkGateAsciiImageIOFactory.h"
 #include "clitkConfiguration.h"
@@ -76,6 +77,7 @@ void clitk::RegisterClitkFactories()
   rtk::HndImageIOFactory::RegisterOneFactory();
   rtk::EdfImageIOFactory::RegisterOneFactory();
   rtk::ImagXImageIOFactory::RegisterOneFactory();
+  rtk::XRadImageIOFactory::RegisterOneFactory();
   clitk::EsrfHstImageIOFactory::RegisterOneFactory();
 #if ITK_VERSION_MAJOR >= 4
   itk::GDCMImageIOFactory::RegisterOneFactory();
diff --git a/common/rtkXRadImageIO.cxx b/common/rtkXRadImageIO.cxx
new file mode 100644 (file)
index 0000000..1db3027
--- /dev/null
@@ -0,0 +1,161 @@
+/*=========================================================================
+ *
+ *  Copyright RTK Consortium
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0.txt
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *=========================================================================*/
+
+#include "rtkXRadImageIO.h"
+
+#include <itkRawImageIO.h>
+#include <itkMetaDataObject.h>
+
+//--------------------------------------------------------------------
+// Read Image Information
+void rtk::XRadImageIO::ReadImageInformation()
+{
+  std::ifstream is;
+  is.open(m_FileName.c_str());
+
+  if(!is.is_open())
+    itkExceptionMacro(<<"Could not open file " << m_FileName);
+
+  SetNumberOfDimensions(3);
+  while(!is.eof())
+    {
+    std::string line;
+    std::string section;
+    std::getline(is, line);
+    if(line.find('[')!=std::string::npos)
+      {
+      unsigned int pos1 = line.find('[');
+      unsigned int pos2 = line.find(']');
+      section = line.substr(pos1+1, pos2-pos1-1);
+      }
+    if(line.find('=')!=std::string::npos)
+      {
+      unsigned int pos       = line.find('=');
+      std::string paramName  = line.substr(0,pos);
+      std::string paramValue = line.substr(pos+1, line.length()-pos-1);
+
+      if(paramName == std::string("CBCT.DimensionalAttributes.IDim"))
+        SetDimensions(0, atoi(paramValue.c_str()));
+      else if(paramName == std::string("CBCT.DimensionalAttributes.JDim"))
+        SetDimensions(1, atoi(paramValue.c_str()));
+      else if(paramName == std::string("CBCT.DimensionalAttributes.KDim"))
+        SetDimensions(2, atoi(paramValue.c_str()));
+      else if(paramName == std::string("CBCT.DimensionalAttributes.DataSize"))
+        {
+        if(atoi(paramValue.c_str())==3)
+          SetComponentType(itk::ImageIOBase::FLOAT);
+        if(atoi(paramValue.c_str())==6)
+          SetComponentType(itk::ImageIOBase::USHORT);
+        }
+      else if(paramName == std::string("CBCT.DimensionalAttributes.PixelDimension_I_cm"))
+        {
+        double spacing = 0.1*atof(paramValue.c_str());
+        SetSpacing(0, (spacing==0.)?1.:spacing);
+        }
+      else if(paramName == std::string("CBCT.DimensionalAttributes.PixelDimension_J_cm"))
+        {
+        double spacing = 0.1*atof(paramValue.c_str());
+        SetSpacing(1, (spacing==0.)?1.:spacing);
+        }
+      else if(paramName == std::string("CBCT.DimensionalAttributes.PixelDimension_K_cm"))
+        {
+        double spacing = 0.1*atof(paramValue.c_str());
+        SetSpacing(2, (spacing==0.)?1.:spacing);
+        }
+      else
+        {
+        paramName = section + std::string("_") + paramName;
+        itk::EncapsulateMetaData<std::string>(this->GetMetaDataDictionary(),
+                                              paramName.c_str(),
+                                              paramValue);
+        }
+      }
+
+    }
+} ////
+
+//--------------------------------------------------------------------
+// Read Image Information
+bool rtk::XRadImageIO::CanReadFile(const char* FileNameToRead)
+{
+  std::string                  filename(FileNameToRead);
+  const std::string::size_type it = filename.find_last_of( "." );
+  std::string                  fileExt( filename, it+1, filename.length() );
+
+  if (fileExt != std::string("header") ) return false;
+  return true;
+} ////
+
+//--------------------------------------------------------------------
+// Read Image Content
+void rtk::XRadImageIO::Read(void * buffer)
+{
+  // Adapted from itkRawImageIO
+  std::string rawFileName( m_FileName, 0, m_FileName.size()-6);
+  rawFileName += "img";
+
+  std::ifstream is(rawFileName.c_str(), std::ios::binary);
+  if(!is.is_open() )
+    itkExceptionMacro(<<"Could not open file " << rawFileName);
+
+  unsigned long numberOfBytesToBeRead = GetComponentSize();
+  for(unsigned int i=0; i<GetNumberOfDimensions(); i++) numberOfBytesToBeRead *= GetDimensions(i);
+
+  if(!this->ReadBufferAsBinary(is, buffer, numberOfBytesToBeRead) ) {
+    itkExceptionMacro(<<"Read failed: Wanted "
+                      << numberOfBytesToBeRead
+                      << " bytes, but read "
+                      << is.gcount() << " bytes.");
+    }
+  itkDebugMacro(<< "Reading Done");
+
+  // Adapted from itkRawImageIO
+    {
+    using namespace itk;
+    // Swap bytes if necessary
+    if itkReadRawBytesAfterSwappingMacro( unsigned short, USHORT )
+    else if itkReadRawBytesAfterSwappingMacro( short, SHORT )
+    else if itkReadRawBytesAfterSwappingMacro( char, CHAR )
+    else if itkReadRawBytesAfterSwappingMacro( unsigned char, UCHAR )
+    else if itkReadRawBytesAfterSwappingMacro( unsigned int, UINT )
+    else if itkReadRawBytesAfterSwappingMacro( int, INT )
+    else if itkReadRawBytesAfterSwappingMacro( unsigned int, ULONG )
+    else if itkReadRawBytesAfterSwappingMacro( int, LONG )
+    else if itkReadRawBytesAfterSwappingMacro( float, FLOAT )
+    else if itkReadRawBytesAfterSwappingMacro( double, DOUBLE );
+    }
+}
+
+//--------------------------------------------------------------------
+// Write Image Information
+void rtk::XRadImageIO::WriteImageInformation(bool keepOfStream)
+{
+}
+
+//--------------------------------------------------------------------
+// Write Image Information
+bool rtk::XRadImageIO::CanWriteFile(const char* FileNameToWrite)
+{
+  return false;
+}
+
+//--------------------------------------------------------------------
+// Write Image
+void rtk::XRadImageIO::Write(const void * buffer)
+{
+} ////
diff --git a/common/rtkXRadImageIO.h b/common/rtkXRadImageIO.h
new file mode 100644 (file)
index 0000000..8229455
--- /dev/null
@@ -0,0 +1,77 @@
+/*=========================================================================
+ *
+ *  Copyright RTK Consortium
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0.txt
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *=========================================================================*/
+
+#ifndef __rtkXRadImageIO_h
+#define __rtkXRadImageIO_h
+
+#include <itkImageIOBase.h>
+#include <fstream>
+#include <string.h>
+
+namespace rtk {
+
+/** \class XRadImageIO
+ * \brief Class for reading XRad image file format. XRad is the format of
+ * exported X-ray projection images on the small animal irradiator SMART.
+ * http://www.pxinc.com/products/small-animal-igrt-platform/x-rad-225cx/
+ *
+ * \author Simon Rit
+ *
+ * \ingroup IOFilters
+ */
+class XRadImageIO : public itk::ImageIOBase
+{
+public:
+  /** Standard class typedefs. */
+  typedef XRadImageIO             Self;
+  typedef itk::ImageIOBase        Superclass;
+  typedef itk::SmartPointer<Self> Pointer;
+
+  XRadImageIO(): Superclass() {}
+
+  /** Method for creation through the object factory. */
+  itkNewMacro(Self);
+
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(XRadImageIO, ImageIOBase);
+
+  /*-------- This part of the interface deals with reading data. ------ */
+  virtual void ReadImageInformation();
+
+  virtual bool CanReadFile( const char* FileNameToRead );
+
+  virtual void Read(void * buffer);
+
+  /*-------- This part of the interfaces deals with writing data. ----- */
+  virtual void WriteImageInformation(bool keepOfStream);
+
+  virtual void WriteImageInformation() {
+    WriteImageInformation(false);
+  }
+
+  virtual bool CanWriteFile(const char* filename);
+
+  virtual void Write(const void* buffer);
+
+protected:
+
+}; // end class XRadImageIO
+
+} // end namespace
+
+#endif
diff --git a/common/rtkXRadImageIOFactory.cxx b/common/rtkXRadImageIOFactory.cxx
new file mode 100644 (file)
index 0000000..2b29897
--- /dev/null
@@ -0,0 +1,29 @@
+/*=========================================================================
+ *
+ *  Copyright RTK Consortium
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0.txt
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *=========================================================================*/
+
+#include "rtkXRadImageIOFactory.h"
+
+//====================================================================
+rtk::XRadImageIOFactory::XRadImageIOFactory()
+{
+  this->RegisterOverride("itkImageIOBase",
+                         "XRadImageIO",
+                         "XRad Image IO",
+                         1,
+                         itk::CreateObjectFunction<XRadImageIO>::New() );
+}
diff --git a/common/rtkXRadImageIOFactory.h b/common/rtkXRadImageIOFactory.h
new file mode 100644 (file)
index 0000000..1651918
--- /dev/null
@@ -0,0 +1,77 @@
+/*=========================================================================
+ *
+ *  Copyright RTK Consortium
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0.txt
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *=========================================================================*/
+
+#ifndef __rtkXRadImageIOFactory_h
+#define __rtkXRadImageIOFactory_h
+
+#include "rtkXRadImageIO.h"
+#include <itkImageIOBase.h>
+#include <itkObjectFactoryBase.h>
+#include <itkVersion.h>
+
+namespace rtk {
+
+/** \class XRadImageIOFactory
+ * \brief ITK factory for XRad file I/O.
+ *
+ * \author Simon Rit
+ */
+class XRadImageIOFactory : public itk::ObjectFactoryBase
+{
+public:
+  /** Standard class typedefs. */
+  typedef XRadImageIOFactory            Self;
+  typedef itk::ObjectFactoryBase        Superclass;
+  typedef itk::SmartPointer<Self>       Pointer;
+  typedef itk::SmartPointer<const Self> ConstPointer;
+
+  /** Class methods used to interface with the registered factories. */
+  const char* GetITKSourceVersion(void) const {
+    return ITK_SOURCE_VERSION;
+  }
+
+  const char* GetDescription(void) const {
+    return "XRad ImageIO Factory, allows the loading of XRad images into insight";
+  }
+
+  /** Method for class instantiation. */
+  itkFactorylessNewMacro(Self);
+
+  /** Run-time type information (and related methods). */
+  itkTypeMacro(XRadImageIOFactory, ObjectFactoryBase);
+
+  /** Register one factory of this type  */
+  static void RegisterOneFactory(void) {
+    ObjectFactoryBase::RegisterFactory( Self::New() );
+  }
+
+protected:
+  XRadImageIOFactory();
+  ~XRadImageIOFactory() {}
+
+  typedef XRadImageIOFactory myProductType;
+  const myProductType* m_MyProduct;
+private:
+  XRadImageIOFactory(const Self&); //purposely not implemented
+  void operator=(const Self&);    //purposely not implemented
+
+};
+
+} // end namespace
+
+#endif
index 31c6ef0fecd8234ecde506d542a8884b2293e84b..9842d4a7f2f64945580c53a6779b82957f561e55 100644 (file)
@@ -269,6 +269,11 @@ bool vvImage::HaveSameSizeAndSpacingThan(vvImage * other)
   return same;
 }
 //--------------------------------------------------------------------
+itk::MetaDataDictionary* vvImage::GetFirstMetaDataDictionary()
+{
+    return mDictionary[0];
+}
+//--------------------------------------------------------------------
 
 
 #endif // VVIMAGE_CXX
index a120457f6f9f5a5f375f22cd426f5262cf05af9e..7240be82c4ef5843a221ed34930d4b0691dc8ea5 100644 (file)
@@ -60,6 +60,8 @@ public :
   void SetTimeSpacing(double s) { mTimeSpacing = s; }
   void SetTimeOrigin(double o) { mTimeOrigin = o; }
   bool HaveSameSizeAndSpacingThan(vvImage * other);
+  //META DATA
+  itk::MetaDataDictionary* GetFirstMetaDataDictionary();
 
 private:
   vvImage();
@@ -68,6 +70,8 @@ private:
   std::vector< ConverterPointer > mItkToVtkConverters;
   std::vector< vtkImageData* > mVtkImages;
   std::vector< vtkSmartPointer<vtkTransform> > mTransform;
+  //META DATA
+  std::vector< itk::MetaDataDictionary* > mDictionary;
 
   double mTimeOrigin;
   double mTimeSpacing;
index 55b785fb4814571fd4c0a7788699d03c848b937f..a6d37c8cbbd8f0447f69c990235fa0963afedb53 100644 (file)
@@ -52,6 +52,8 @@ void vvImage::AddItkImage(TItkImageType *input)
 
   mTransform.push_back(vtkSmartPointer<vtkTransform>::New());
   mTransform.back()->SetMatrix(matrix);
+  //META DATA
+  mDictionary.push_back(&(input->GetMetaDataDictionary()));
 }
 //--------------------------------------------------------------------
 
index 99465547695d6403dea2c271e55ffba93da8c14b..781775f0cc9541c488ca0ddfa4b8566b8ddc9779 100644 (file)
@@ -143,6 +143,9 @@ namespace clitk {
     itkGetConstMacro(Radius, double);
     itkSetMacro(Radius, double);
 
+    itkSetMacro(K1, double);
+    itkGetMacro(K1, double);
+
     typename FloatImageType::Pointer GetFuzzyMap() { return m_FuzzyMap; }
 
     // I dont want to verify inputs information
@@ -171,6 +174,7 @@ namespace clitk {
     bool m_FuzzyMapOnlyFlag;
     bool m_FastFlag;
     double m_Radius;
+    double m_K1;
 
     virtual void GenerateOutputInformation();
     virtual void GenerateInputRequestedRegion();
index ddcad0e16c445959381f5b197d7b94cce3f35ece..a3759f49fa2f69606401d0d5289faaf96c70f3d3 100644 (file)
@@ -65,6 +65,7 @@ AddRelativePositionConstraintToLabelImageFilter():
   FuzzyMapOnlyFlagOff();
   FastFlagOff();
   SetRadius(2.0);
+  SetK1(vcl_acos(-1.0)/2);
 }
 //--------------------------------------------------------------------
 
@@ -387,12 +388,9 @@ GenerateData()
     relPosFilter->SetInput(working_image);
     relPosFilter->SetAlpha1(m_Angle1[i]); // xy plane
     relPosFilter->SetAlpha2(m_Angle2[i]);
-    relPosFilter->SetK1(M_PI/2.0); // Opening parameter, default = pi/2
-
-    // relPosFilter->SetFast(true);
-    // relPosFilter->SetRadius(1); // seems sufficient in this case
-
+    relPosFilter->SetK1(GetK1());// M_PI/2.0); // Opening parameter, default = pi/2
     // relPosFilter->SetVerboseProgress(true);
+
     relPosFilter->Update();
     relPos = relPosFilter->GetOutput();
 
@@ -444,6 +442,7 @@ GenerateData()
       resampleFilter->SetGaussianFilteringEnabled(false);
       resampleFilter->Update();
       relPos = m_FuzzyMap = resampleFilter->GetOutput();
+      StopCurrentStep<FloatImageType>(relPos);
 
       // Need to put exactly the same size
       if (relPos->GetLargestPossibleRegion() != input->GetLargestPossibleRegion()) {
index 43874d0265f60cd70b11c5916a5b3c5bea85a74c..a449388fbdca9516594dc425ecb5510b5087e9cf 100644 (file)
@@ -106,6 +106,7 @@ GenerateData() {
   m_region.SetSize(m_size);
   int start = m_index[GetDirection()];
   this->SetNumberOfOutputs(m_NumberOfSlices);
+  // deprecated : use SetNumberOfIndexedInputs ? FIXME
 
   //--------------------------------------------------------------------
   // loop ExtractImageFilter with region updated, push_back
@@ -122,7 +123,7 @@ GenerateData() {
     extract->SetDirectionCollapseToSubmatrix();
 #endif
     extract->Update();
-    SetNthOutput(i, extract->GetOutput());
+    this->SetNthOutput(i, extract->GetOutput());
   }
   return;
 }
index a29aa6a3f810eb1987a8adbd2f62b82bc7d1e4a2..037570916b0346be55ed56ff47cf1988485db821 100644 (file)
@@ -94,9 +94,17 @@ GenerateData()
   ImagePointer image_intersection = clitk::Clone<ImageType>(input1);
   clitk::Or<ImageType>(image_union, input2, GetBackgroundValue());
   clitk::And<ImageType>(image_intersection, input2, GetBackgroundValue());
+
+  ImagePointer image_1NotIn2 = clitk::Clone<ImageType>(input1);
+  clitk::AndNot<ImageType>(image_1NotIn2, input2, GetBackgroundValue());
   
+  ImagePointer image_2NotIn1 = clitk::Clone<ImageType>(input2);
+  clitk::AndNot<ImageType>(image_2NotIn1, input1, GetBackgroundValue());
+
   //writeImage<ImageType>(image_union, "union.mha");
   //writeImage<ImageType>(image_intersection, "intersection.mha");
+  //writeImage<ImageType>(image_1NotIn2, "image_1NotIn2.mha");
+  //writeImage<ImageType>(image_2NotIn1, "image_2NotIn1.mha");
   
   // Compute size
   typedef itk::LabelStatisticsImageFilter<ImageType, ImageType> StatFilterType;
@@ -121,12 +129,24 @@ GenerateData()
   statFilter->Update();
   int in2 = statFilter->GetCount(GetLabel1());
 
+  statFilter->SetInput(image_1NotIn2);
+  statFilter->SetLabelInput(image_1NotIn2);
+  statFilter->Update();
+  int l1notIn2 = statFilter->GetCount(GetLabel1());
+
+  statFilter->SetInput(image_2NotIn1);
+  statFilter->SetLabelInput(image_2NotIn1);
+  statFilter->Update();
+  int l2notIn1 = statFilter->GetCount(GetLabel1());
+
   double dice = 2.0*(double)inter/(double)(in1+in2);
   int width = 6;
   std::cout << std::setw(width) << in1 << " "
             << std::setw(width) << in2 << " "
             << std::setw(width) << inter  << " "
             << std::setw(width) << u  << " "
+            << std::setw(width) << l1notIn2  << " "
+            << std::setw(width) << l2notIn1  << " "
             << std::setw(width) << dice << " "; //std::endl;
 }
 //--------------------------------------------------------------------
index 6389ad135c4c3202701b3eaed5c50729d082d365..5ac8c4c51e86c2d7b5345fcefda25ea8ba8b3ec0 100644 (file)
@@ -85,11 +85,13 @@ namespace clitk {
   template<class ImageType>
   typename ImageType::Pointer
   AutoCrop(const ImageType * input, 
-           typename ImageType::PixelType BG) {
+           typename ImageType::PixelType BG, 
+           const bool useBorderFlag=false) {
     typedef clitk::AutoCropFilter<ImageType> AutoCropFilterType;
     typename AutoCropFilterType::Pointer autoCropFilter = AutoCropFilterType::New();
     autoCropFilter->SetInput(input);
     autoCropFilter->SetBackgroundValue(BG);
+    autoCropFilter->SetUseBorder(useBorderFlag);
     autoCropFilter->Update();   
     return autoCropFilter->GetOutput();
   }
@@ -337,7 +339,16 @@ namespace clitk {
                                               std::vector<typename ImageType::PointType> & lB, 
                                               typename ImageType::PixelType BG, 
                                               int mainDirection, 
-                                              double offsetToKeep);
+                                              double offsetToKeep, 
+                                              bool keepIfEqual=false);
+  template<class ImageType>
+  void 
+  SliceBySliceSetBackgroundFromLineSeparation_pt(ImageType * input, 
+                                              std::vector<typename ImageType::PointType> & lA, 
+                                              std::vector<typename ImageType::PointType> & lB, 
+                                              typename ImageType::PixelType BG, 
+                                              typename ImageType::PointType offsetToKeep, 
+                                              bool keepIfEqual=false);
   //--------------------------------------------------------------------
 
 
index a57d8136becb4b919b1b1bc9360f6343c6547028..75e5ef35f982b2d7e33fff174af5ae7b77c8ad40 100644 (file)
@@ -354,7 +354,7 @@ namespace clitk {
       ++iter;
     }
     if (!found) return false;
-    input->TransformIndexToPhysicalPoint(max, point);
+    input->TransformIndexToPhysicalPoint(max, point); // half of the pixel
     return true;
   }
   //--------------------------------------------------------------------
@@ -382,14 +382,12 @@ namespace clitk {
                  int dim, double max, bool autoCrop,
                  typename ImageType::PixelType BG) 
   {
-    typename ImageType::PointType p;
+    typename ImageType::PointType p; 
+    
     image->TransformIndexToPhysicalPoint(image->GetLargestPossibleRegion().GetIndex()+
                                          image->GetLargestPossibleRegion().GetSize(), p);
-    // Add GetSpacing because remove Lower or equal than
-    // DD(max);
-    // DD(p);
-    // DD(max+image->GetSpacing()[dim]);
-    return CropImageAlongOneAxis<ImageType>(image, dim, max+image->GetSpacing()[dim], p[dim], autoCrop, BG);
+
+    return CropImageAlongOneAxis<ImageType>(image, dim, max, p[dim], autoCrop, BG);
   }
   //--------------------------------------------------------------------
 
@@ -404,16 +402,24 @@ namespace clitk {
     // Compute region size
     typename ImageType::RegionType region;
     typename ImageType::SizeType size = image->GetLargestPossibleRegion().GetSize();
-    typename ImageType::PointType p = image->GetOrigin();
+    
+    // Starting index
+    typename ImageType::PointType p = image->GetOrigin(); // not at pixel center !
     if (min > p[dim]) p[dim] = min; // Check if not outside the image
     typename ImageType::IndexType start;
     image->TransformPhysicalPointToIndex(p, start);
-    double m = image->GetOrigin()[dim] + size[dim]*image->GetSpacing()[dim];
+
+    // Size of the region
+    // -1 because last point is size -1
+    double m = image->GetOrigin()[dim] + (size[dim]-1)*image->GetSpacing()[dim];
     if (max > m) p[dim] = m; // Check if not outside the image
     else p[dim] = max;
+
     typename ImageType::IndexType end;
     image->TransformPhysicalPointToIndex(p, end);
-    size[dim] = abs(end[dim]-start[dim]);
+    size[dim] = abs(end[dim]-start[dim])+1;// +1 because we want to include the point. 
+    
+    // Set region
     region.SetIndex(start);
     region.SetSize(size);
   
@@ -762,9 +768,24 @@ namespace clitk {
                                               std::vector<typename ImageType::PointType> & lB, 
                                               typename ImageType::PixelType BG, 
                                               int mainDirection, 
-                                              double offsetToKeep)
+                                              double offsetToKeep,
+                                              bool keepIfEqual)
   {
     assert((mainDirection==0) || (mainDirection==1));
+    typename ImageType::PointType offset;
+    offset[0] = offset[1] = offset[2] = 0.0;
+    offset[mainDirection] = offsetToKeep;
+    SliceBySliceSetBackgroundFromLineSeparation_pt<ImageType>(input, lA, lB, BG, offset, keepIfEqual);
+  }
+  template<class ImageType>
+  void 
+  SliceBySliceSetBackgroundFromLineSeparation_pt(ImageType * input, 
+                                                 std::vector<typename ImageType::PointType> & lA, 
+                                                 std::vector<typename ImageType::PointType> & lB, 
+                                                 typename ImageType::PixelType BG, 
+                                                 typename ImageType::PointType offsetToKeep,
+                                                 bool keepIfEqual)
+  {
     typedef itk::ImageSliceIteratorWithIndex<ImageType> SliceIteratorType;
     SliceIteratorType siter = SliceIteratorType(input, input->GetLargestPossibleRegion());
     siter.SetFirstDirection(0);
@@ -779,6 +800,8 @@ namespace clitk {
       // Check that the current slice correspond to the current point
       input->TransformIndexToPhysicalPoint(siter.GetIndex(), C);
       if ((fabs(C[2] - lA[i][2]))>0.01) { // is !equal with a tolerance of 0.01 mm
+        // FIXME : if not the same slices, should advance i or slice (not done yet)
+        //        clitkExceptionMacro("Error list of point and slice do not start at the same location");
       }
       else {
         // Define A,B,C points
@@ -789,20 +812,27 @@ namespace clitk {
         bool p = (A[0] == B[0]) && (A[1] == B[1]);
       
         if (!p) {
-          C[mainDirection] += offsetToKeep; // I know I must keep this point
+          //C[mainDirection] += offsetToKeep; // I know I must keep this point
+          C[0] += offsetToKeep[0];
+          C[1] += offsetToKeep[1];
+          //C[2] += offsetToKeep[2]; 
           double s = (B[0] - A[0]) * (C[1] - A[1]) - (B[1] - A[1]) * (C[0] - A[0]);
           bool isPositive = s<0;
           while (!siter.IsAtEndOfSlice()) {
             while (!siter.IsAtEndOfLine()) {
-              // Very slow, I know ... but image should be very small
-              input->TransformIndexToPhysicalPoint(siter.GetIndex(), C);
-              double s = (B[0] - A[0]) * (C[1] - A[1]) - (B[1] - A[1]) * (C[0] - A[0]);
-              if (s == 0) siter.Set(BG); // on the line, we decide to remove
-              if (isPositive) {
-                if (s > 0) siter.Set(BG);
-              }
-              else {
-                if (s < 0) siter.Set(BG); 
+              if (siter.Get() != BG) { // do only if not BG
+                // Very slow, I know ... but image should be very small
+                input->TransformIndexToPhysicalPoint(siter.GetIndex(), C);
+                double s = (B[0] - A[0]) * (C[1] - A[1]) - (B[1] - A[1]) * (C[0] - A[0]);
+                if (s == 0) {
+                  if (!keepIfEqual) siter.Set(BG); // on the line, we decide to remove
+                }
+                if (isPositive) {
+                  if (s > 0) siter.Set(BG);
+                }
+                else {
+                  if (s < 0) siter.Set(BG); 
+                }
               }
               ++siter;
             }
@@ -1340,14 +1370,14 @@ namespace clitk {
 
     }
 
-    // Debug dmap
     /*
-      typedef itk::Image<float,3> FT;
-      FT::Pointer f = FT::New();
-      typename FT::Pointer d1 = clitk::JoinSlices<FT>(dmaps1, S1, 2);
-      typename FT::Pointer d2 = clitk::JoinSlices<FT>(dmaps2, S2, 2);
-      writeImage<FT>(d1, "d1.mha");
-      writeImage<FT>(d2, "d2.mha");
+    // Debug dmap
+    typedef itk::Image<float,3> FT;
+    FT::Pointer f = FT::New();
+    typename FT::Pointer d1 = clitk::JoinSlices<FT>(dmaps1, S1, 2);
+    typename FT::Pointer d2 = clitk::JoinSlices<FT>(dmaps2, S2, 2);
+    writeImage<FT>(d1, "d1.mha");
+    writeImage<FT>(d2, "d2.mha");
     */
   }
   //--------------------------------------------------------------------
index ba59467f5ece21cc3b7538ba47ce40c19153297a..5989e20054c5229a0146543a5be06dba1d60444c 100644 (file)
@@ -138,4 +138,8 @@ namespace clitk {
 #include "clitkSliceBySliceRelativePositionFilter.txx"
 #endif
 
+typedef unsigned char                    PixelType_uchar;
+typedef itk::Image<PixelType_uchar, 3>   ImageType_uchar;    
+extern template class clitk::SliceBySliceRelativePositionFilter<ImageType_uchar>;
+
 #endif
index e68514da031c0f6f1a6725a2df78f97d0c189fe7..16571ea7a224df6b17d87425d7cf8bde619a66b0 100644 (file)
@@ -43,6 +43,7 @@ SliceBySliceRelativePositionFilter():
   SetObjectCCLSelectionDirection(1);
   ObjectCCLSelectionIgnoreSingleCCLFlagOff();
   VerboseSlicesFlagOff();
+  this->SetK1(vcl_acos(-1.0)/2);
 }
 //--------------------------------------------------------------------
 
@@ -98,7 +99,8 @@ PrintOptions(std::ostream & os)
      << "ObjectCCLSelectionIgnoreSingleCCLFlag = " << this->GetObjectCCLSelectionIgnoreSingleCCLFlag() << std::endl    
      << "IgnoreEmptySliceObjectFlag = " << this->GetIgnoreEmptySliceObjectFlag() << std::endl
      << "(RP) FastFlag              = " << this->GetFastFlag() << std::endl
-     << "(RP) Radius                = " << this->GetRadius() << std::endl;
+     << "(RP) Radius                = " << this->GetRadius() << std::endl
+     << "(RP) K1                    = " << this->GetK1() << std::endl;
 }
 //--------------------------------------------------------------------
 
@@ -238,6 +240,10 @@ GenerateOutputInformation()
     int nb=0;
     mObjectSlices[i] = LabelizeAndCountNumberOfObjects<SliceType>(mObjectSlices[i], 0, true, 1, nb);
 
+    if (GetVerboseSlicesFlag()) {
+      std::cout << "slice " << i << " nb = " << nb << std::endl;
+    }
+
     // If no object and empty slices and if we need the full fuzzy map, create a dummy one.
     if ((nb==0) && (this->GetFuzzyMapOnlyFlag())) {
       typename FloatSliceType::Pointer one = FloatSliceType::New();
@@ -295,6 +301,7 @@ GenerateOutputInformation()
         if (GetVerboseSlicesFlag()) {
           std::cout << "Slice " << i << std::endl;
           relPosFilter->VerboseStepFlagOn();
+          //relPosFilter->WriteStepFlagOn();
         }
         relPosFilter->WriteStepFlagOff();
         // relPosFilter->VerboseMemoryFlagOn();
@@ -319,6 +326,7 @@ GenerateOutputInformation()
         //        relPosFilter->SetComputeFuzzyMapFlag(this->GetComputeFuzzyMapFlag());      
         relPosFilter->SetFastFlag(this->GetFastFlag());
         relPosFilter->SetRadius(this->GetRadius());
+        relPosFilter->SetK1(this->GetK1());
 
         // Go !
         relPosFilter->Update();
index 64b55dccfa0e71a6b33e3be2e333980bf52db9a9..1bf1bf5796824bcb03dda629fd1f898580f7a618 100644 (file)
@@ -44,7 +44,6 @@ IF(CLITK_BUILD_REGISTRATION)
     TARGET_LINK_LIBRARIES(clitkConvertBSplineDeformableTransformToVF clitkCommon  ${ITK_LIBRARIES})
     SET(REGISTRATION_INSTALL ${REGISTRATION_INSTALL} clitkConvertBSplineDeformableTransformToVF)
 
-#    SET_TARGET_PROPERTIES(${REGISTRATION_INSTALL} PROPERTIES INSTALL_RPATH "${VTK_DIR}:${ITK_DIR}" )  
     INSTALL (TARGETS ${REGISTRATION_INSTALL} DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
 
 ENDIF(CLITK_BUILD_REGISTRATION)
index 2e1ddac611cb2cf9ce1aef94770b71509641cd6d..7e635ddf9332386f97d8678b2c33bd65f5a2aaeb 100644 (file)
@@ -8,6 +8,7 @@ ENDFOREACH(clitkTool)
 ADD_LIBRARY(clitkSegmentationGgoLib
             clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx
             clitkAnatomicalFeatureDatabase.cxx
+            clitkSliceBySliceRelativePositionFilter_uchar.cxx
             ${GGO_C_FILES})
 
 #=========================================================
@@ -50,7 +51,6 @@ IF(CLITK_BUILD_SEGMENTATION)
     ADD_EXECUTABLE(clitkRegionGrowing clitkRegionGrowing.cxx ${clitkRegionGrowing_GGO_C} ${clitkRelativePosition_GGO_C})
     TARGET_LINK_LIBRARIES(clitkRegionGrowing clitkCommon ${ITK_LIBRARIES})
 
-#    SET_TARGET_PROPERTIES(${SEGMENTATION_INSTALL} PROPERTIES INSTALL_RPATH "${VTK_DIR}:${ITK_DIR}" )  
     INSTALL (TARGETS ${SEGMENTATION_INSTALL} DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
 
 ENDIF(CLITK_BUILD_SEGMENTATION)
index 1a5ab247e5eb158a095d7ce515e555c99610ee08..cb38852edfdaa53acf89af280b0dbad16167a017 100644 (file)
@@ -46,6 +46,7 @@ void clitk::ConnectedComponentLabelingGenericFilter<ArgsInfoType>::InitializeIma
 {  
   ADD_IMAGE_TYPE(Dim, uchar);
   ADD_IMAGE_TYPE(Dim, short);
+  ADD_IMAGE_TYPE(Dim, ushort);
   // ADD_IMAGE_TYPE(Dim, int);
   ADD_IMAGE_TYPE(Dim, float);
 }
index 7bb97561c6d84b69f018434b93a4f392bc286a4e..ae87cc8363afc36d6225d90cb36fef33505dec6b 100644 (file)
@@ -36,6 +36,8 @@ template<unsigned int Dim>
 void clitk::ExtractPatientGenericFilter<ArgsInfoType>::InitializeImageType() 
 {  
   ADD_IMAGE_TYPE(Dim, short);
+  ADD_IMAGE_TYPE(Dim, unsigned short);
+  ADD_IMAGE_TYPE(Dim, float);
   // ADD_IMAGE_TYPE(Dim, int);
   // ADD_IMAGE_TYPE(Dim, float);
 }
index 4f4702b981c809b6705f1102bd1b4cebc32ac95d..8d89e9fd364320d058ec1ba6ad88950ea9e12e58 100644 (file)
@@ -173,19 +173,22 @@ GenerateOutputInformation() {
   for(uint i=0; i<mArgsInfoList.size(); i++) {
 
     // clitk::PrintMemory(true, "Start"); 
-    std::string text = "["+s+"] limits ";
+    // remove _S in station name
+    std::string sname = s;
+    clitk::findAndReplace<std::string>(sname, "_S", " ");
+    std::string text = "["+sname+"] ";
     if (mArgsInfoList[i].orientation_given) text += std::string(mArgsInfoList[i].orientation_arg[0])+" ";
     else text = text+"("+toString(mArgsInfoList[i].angle1_arg)+" "+
            toString(mArgsInfoList[i].angle2_arg)+" "+
            (mArgsInfoList[i].inverse_flag?"true":"false")+") ";
     text = text+mArgsInfoList[i].object_arg+" "+toString(mArgsInfoList[i].threshold_arg);
     if (mArgsInfoList[i].sliceBySlice_flag) {
-      text += " slice by slice";
+      text += " SbS";
     }
     else text += " 3D";
-    text += " spacing=" + toString(mArgsInfoList[i].spacing_arg);
+    text += " sp=" + toString(mArgsInfoList[i].spacing_arg)+" ";
 
-    StartNewStep(text);  
+    StartNewStep(text, false); // no endl
     typename RelPosFilterType::Pointer relPosFilter;
 
     // Is it slice by slice or 3D ?
@@ -198,6 +201,7 @@ GenerateOutputInformation() {
       f->SetUniqueConnectedComponentBySliceFlag(mArgsInfoList[i].uniqueCCL_flag);
       f->SetObjectCCLSelectionFlag(mArgsInfoList[i].uniqueObjectCCL_flag);
       f->IgnoreEmptySliceObjectFlagOn();
+      f->SetVerboseSlicesFlag(mArgsInfoList[i].verboseSlices_flag);
       //f->SetObjectCCLSelectionDimension(0);
       //f->SetObjectCCLSelectionDirection(-1);
       //f->SetAutoCropFlag(false);
@@ -227,7 +231,7 @@ GenerateOutputInformation() {
       filter->SetInput(1, m_reference);
       filter->Update();
     }
-    
+    std::cout << std::endl;    
   }
 }
 //--------------------------------------------------------------------
@@ -260,9 +264,12 @@ SetFilterOptions(typename RelPosFilterType::Pointer filter, ArgsInfoType & optio
   ImagePointer object = GetAFDB()->template GetImage<ImageType>(options.object_arg);
   filter->SetInputObject(object);
   filter->WriteStepFlagOff();
+  filter->SetRadius(options.radius_arg);
+  if (options.writeStep_flag) filter->WriteStepFlagOn();
   filter->SetVerboseImageSizeFlag(GetVerboseImageSizeFlag());
   filter->SetFuzzyThreshold(options.threshold_arg);
   filter->SetInverseOrientationFlag(options.inverse_flag); // MUST BE BEFORE AddOrientationTypeString
+  filter->SetFastFlag(options.fastFlag_flag);
 
   if (options.orientation_given == 1)  {
     for(uint i=0; i<options.orientation_given; i++) 
diff --git a/segmentation/clitkSliceBySliceRelativePositionFilter_uchar.cxx b/segmentation/clitkSliceBySliceRelativePositionFilter_uchar.cxx
new file mode 100644 (file)
index 0000000..f0138af
--- /dev/null
@@ -0,0 +1,29 @@
+/*=========================================================================
+  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://oncora1.lyon.fnclcc.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
+  ======================================================================-====*/
+
+#ifndef CLITKSLICEBYSLICERELATIVEPOSITIONFILTER_UCHARH
+#define CLITKSLICEBYSLICERELATIVEPOSITIONFILTER_UCHARH
+
+// clitk
+#include "clitkSliceBySliceRelativePositionFilter.h"
+
+typedef unsigned char                    PixelType_uchar;
+typedef itk::Image<PixelType_uchar, 3>   ImageType_uchar;    
+template class clitk::SliceBySliceRelativePositionFilter<ImageType_uchar>;
+
+#endif
index e62c63030667614439e14b7fbe5b236b9385a3c3..df237735199d9f4b85e38aecd2708c94bdd79ea8 100644 (file)
@@ -62,6 +62,7 @@ ExternalProject_Add(
                                                   -no-libtiff
                                                   -no-libjpeg
                                                   -no-libmng
+                                                  -no-glib
   INSTALL_COMMAND ""
 )
 SET(qmake_executable "${build_prefix}/QT/bin/qmake")
index 71937728a25aea7f049db5e22bf1a9dbed95b14e..862148a10ee91817ef96abeae275f205147beb49 100644 (file)
@@ -223,6 +223,11 @@ IF (CLITK_BUILD_TOOLS)
   TARGET_LINK_LIBRARIES(clitkTransformLandmarks clitkCommon ${ITK_LIBRARIES})
   SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkTransformLandmarks)
 
+  WRAP_GGO(clitkMaskLandmarks_GGO_C clitkMaskLandmarks.ggo)
+  ADD_EXECUTABLE(clitkMaskLandmarks clitkMaskLandmarks.cxx ${clitkMaskLandmarks_GGO_C})
+  TARGET_LINK_LIBRARIES(clitkMaskLandmarks clitkCommon ${ITK_LIBRARIES})
+  SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkMaskLandmarks)
+
   ADD_EXECUTABLE(clitkMakeSphereImage clitkMakeSphereImage.cxx) # clitkLineProfileGenericFilter.cxx ${clitkLineProfile_GGO_C})
   TARGET_LINK_LIBRARIES(clitkMakeSphereImage clitkCommon ${ITK_LIBRARIES})
   SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkMakeSphereImage)
@@ -268,7 +273,6 @@ IF (CLITK_BUILD_TOOLS)
     SET(TOOLS_INSTALL ${TOOLS_INSTALL} clitkDicomRTPlan2Gate)
   ENDIF(ITK_VERSION_MAJOR VERSION_LESS 4)
 
-#   SET_TARGET_PROPERTIES(${TOOLS_INSTALL} PROPERTIES INSTALL_RPATH "${VTK_DIR}:${ITK_DIR}" )  
   INSTALL (TARGETS ${TOOLS_INSTALL} DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 
 ENDIF(CLITK_BUILD_TOOLS)
index 93cd16c91c2928455b4af569a450a985ecaa0a49..0fa4869f2af12d9f680373060faa16ccba109f85 100644 (file)
@@ -211,6 +211,12 @@ AffineTransformGenericFilter<args_info_type>::UpdateWithDimAndPixelType()
     typename itk::Matrix<double, Dimension, Dimension> invRotMatrix( clitk::GetRotationalPartMatrix(invMatrix) );
     typename itk::Vector<double,Dimension> invTrans =  clitk::GetTranslationPartMatrix(invMatrix);
 
+    // Display warning
+    if (m_ArgsInfo.spacing_given)
+      std::cout << "Warning --spacing ignored (because --transform_grid_flag)" << std::endl;
+    if (m_ArgsInfo.origin_given)
+      std::cout << "Warning --origin ignored (because --transform_grid_flag)" << std::endl;
+
     // Spacing is influenced by affine transform matrix and input direction
     typename InputImageType::SpacingType outputSpacing;
     outputSpacing = invRotMatrix *
index 933ce405dca1ae31d95060279c0d409390f19911..e20ec58a8862f532c8f23143edb7de8716bbeada 100644 (file)
@@ -37,9 +37,10 @@ template<class ArgsInfoType>
 template<unsigned int Dim>
 void clitk::AutoCropGenericFilter<ArgsInfoType>::InitializeImageType() 
 {  
-  // ADD_DEFAULT_IMAGE_TYPES(Dim);
+  //ADD_DEFAULT_IMAGE_TYPES(Dim);
   ADD_IMAGE_TYPE(Dim, uchar);
   ADD_IMAGE_TYPE(Dim, ushort);
+  ADD_IMAGE_TYPE(Dim, short);
   // ADD_IMAGE_TYPE(Dim, uint);
  //  ADD_IMAGE_TYPE(Dim, ulong);
   // ADD_IMAGE_TYPE(Dim, int);
index c99af0fa738f16337211088ed10da8cf5f74ea06..dfc37b8021555f843eb454afaa9c29e01b1f8ee2 100644 (file)
@@ -14,6 +14,6 @@ option "upper"        u       "Upper intensity (default=max), fg is lower than this va
 
 option "fg"                    -       "Foreground (FG) or 'inside' value"               double        no      default="1"
 option "bg"                    -       "Background (BG) or 'ouside' value"               double        no      default="0"
-option "mode"          -       "Use FG and/or BG values (if FG, the BG is replaced by the input image values)" values="FG","BG","both"  default="both"
+option "mode"          -       "Use FG and/or BG values (if FG, the BG is replaced by the input image values)" values="FG","BG","both"  no default="both"
 
 
index 4cb22ca85c806ae1bb0d9f941913e8e91a152b01..e0c98212951e71258f4f3cd55f8bc565a3c4c809 100644 (file)
 ===========================================================================**/
 #ifndef CLITKIMAGEARITHM_CXX
 #define CLITKIMAGEARITHM_CXX
-/**
-   -------------------------------------------------
-   * @file   clitkImageArithm.cxx
-   * @author David Sarrut <David.Sarrut@creatis.insa-lyon.fr>
-   * @date   23 Feb 2008 08:37:53
-   -------------------------------------------------*/
 
 // clitk include
 #include "clitkImageArithm_ggo.h"
index fd018635cc45b863786141ad0200569e84591d54..5d85f523e4b4320f699aecf08a1d9954b4daa353 100644 (file)
@@ -13,7 +13,7 @@ option "input2"          j    "Input second image filename"     string   no
 option "output"    o   "Output image filename"           string   yes
 
 option "scalar"           s    "Scalar value"            double   no
-option "operation" t   "Type of operation : \n With another image : 0=add*, 1=multiply, 2=divide,\n 3=max, 4=min, 5=absdiff, 6=squareddiff,  7=difference*, 8=relativ diff\n; For 'scalar' : 0=add*, 1=multiply*, 2=inverse,\n 3=max, 4=min 5=absval 6=squareval\n 7=log 8=exp 9=sqrt 10=EPID 11=divide* 12=normalize (divide by max); \n* operations supported with vector fields as inputs."         int default="0" no 
+option "operation" t   "Type of operation : \n With another image : 0=add*, 1=multiply, 2=divide,\n 3=max, 4=min, 5=absdiff, 6=squareddiff,  7=difference*, 8=relativ diff\n; For 'scalar' : 0=add*, 1=multiply*, 2=inverse,\n 3=max, 4=min 5=absval 6=squareval\n 7=log 8=exp 9=sqrt 10=EPID 11=divide* 12=normalize (divide by max) 13=-ln(I/IO)**; \n* operations supported with vector fields as inputs. \n** for fluence image, if pixel value == 0, consider value=0.5"  int default="0" no 
 option "pixelValue" -  "Default value for NaN/Inf"     double   default="0.0"  no
 
 option "setFloatOutput" f "Set output to float pixel type" flag off
index 4c2f0a58c6ef1f32cf858ddb5a02cfef31c0a722..f3040750d6f8cb61b81ffb9052f511ad579cd761 100644 (file)
@@ -391,6 +391,18 @@ void clitk::ImageArithmGenericFilter<args_info_type>::ComputeImage(Iter1 it, Ite
       ++ito;
     }
     break;
+  case 13: // -ln I/I0
+    while (!it.IsAtEnd()) {
+      if (it.Get() == 0) { // special case for fluence image with 0 value in a pixel -> consider 0.5
+        ito.Set(-log(0.5 / mScalar) );
+      }
+      else {
+        ito.Set(-log(PixelTypeDownCast<double, PixelType>((double)it.Get() / mScalar)) );
+      }
+      ++it;
+      ++ito;
+    }
+    break;
   default: // error ?
     std::cerr << "ERROR : the operation number (" << mTypeOfOperation << ") is not known." << std::endl;
     exit(-1);
index 7b9c78b1cb233a394cef58753e6f8a4d21374313..f5c82356dff35c50bd2a3c841d9dc07ae820bdea 100644 (file)
@@ -50,15 +50,7 @@ namespace clitk
       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_char..." << std::endl;
       UpdateWithDimAndPixelType<Dimension, unsigned char, Components>();
     }
-    
-//     else if (PixelType == "unsigned_int"){ 
-//       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and unsigned_int..." << std::endl;
-//       UpdateWithDimAndPixelType<Dimension, unsigned int, Components>();
-//     }
-    //     else if (PixelType == "char"){ 
-    //       if (m_Verbose) std::cout  << "Launching filter in "<< Dimension <<"D and signed_char..." << std::endl;
-    //       UpdateWithDimAndPixelType<Dimension, signed char>();
-    //     }
+        
     else if(PixelType == "double"){  
       if (m_Verbose) std::cout << "Launching filter in "<< Dimension <<"D and double..." << std::endl;
       UpdateWithDimAndPixelType<Dimension, double, Components>(); 
@@ -148,12 +140,19 @@ namespace clitk
             typename ResamplerType::Pointer resampler = ResamplerType::New();
             resampler->SetInput(labelImage);
             resampler->SetOutputSpacing(input->GetSpacing());
+            resampler->SetGaussianFilteringEnabled(false);
             resampler->Update();
             labelImage = resampler->GetOutput();
+            //writeImage<LabelImageType>(labelImage, "test1.mha");
+            
+            typedef clitk::CropLikeImageFilter<LabelImageType> FilterType;
+            typename FilterType::Pointer crop = FilterType::New();
+            crop->SetInput(labelImage);
+            crop->SetCropLikeImage(input);
+            crop->Update();
+            labelImage = crop->GetOutput();                        
+            //writeImage<LabelImageType>(labelImage, "test2.mha");
 
-            typename itk::ImageBase<LabelImageType::ImageDimension>::RegionType reg 
-              = input->GetLargestPossibleRegion();
-            labelImage = ResizeImageLike<LabelImageType>(labelImage, &reg, 0);
           }
           else {
             std::cerr << "Mask image has a different size/spacing than input. Abort" << std::endl;
index c37c3f606bebc1cc2d3386b0a6227b90d324eabb..0f95400ad18a431e9a45a4fd3c261999f02498ce 100644 (file)
@@ -235,25 +235,8 @@ TARGET_LINK_LIBRARIES(vv vvLib)
 
 #=========================================================
 # Install options (also used by CPack)
-IF(UNIX OR APPLE)
-#   SET_TARGET_PROPERTIES(vv
-#     PROPERTIES INSTALL_RPATH "${VTK_DIR}:${ITK_DIR}")
-  INSTALL (TARGETS vv DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
-  #  INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION .)
+INSTALL (TARGETS vv DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
 
-  #QT
-  #FOREACH(LIB QtCore QtGui QtOpenGL QtNetwork QtSql)
-  #  INSTALL(FILES "${QT_LIBRARY_DIR}/lib${LIB}.so.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}"
-  #          RENAME "lib${LIB}.so.${QT_VERSION_MAJOR}"
-  #          DESTINATION .)
-  #ENDFOREACH(LIB)
-ENDIF(UNIX OR APPLE)
-
-IF(WIN32)
-  #INCLUDE(InstallRequiredSystemLibraries)
-  INSTALL(TARGETS vv DESTINATION bin)
-  #INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/icons/ducky.png DESTINATION .)
-ENDIF(WIN32)
 #=========================================================
 
 #=========================================================
@@ -267,7 +250,11 @@ SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
 SET(CPACK_PACKAGE_VERSION_MAJOR "1")
 SET(CPACK_PACKAGE_VERSION_MINOR "3")
 SET(CPACK_PACKAGE_VERSION_PATCH "0")
-SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vv")
+IF(NIGHTLY)
+  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vv-nightly")
+ELSE(NIGHTLY)
+  SET(CPACK_PACKAGE_INSTALL_DIRECTORY "vv")
+ENDIF(NIGHTLY)
 SET(CPACK_STRIP_FILES TRUE)
 
 IF(WIN32)
@@ -275,11 +262,15 @@ IF(WIN32)
   # sure there is at least one set of four (4) backlasshes.
   SET(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\icons\\\\ducky.ico")
   SET(CPACK_NSIS_INSTALLED_ICON_NAME "vv.exe")
+IF(NIGHTLY)
+  SET(CPACK_NSIS_DISPLAY_NAME "vv - The 4D slicer (nightly)")
+ELSE(NIGHTLY)
   SET(CPACK_NSIS_DISPLAY_NAME "vv - The 4D slicer")
+ENDIF(NIGHTLY)
   SET(CPACK_NSIS_HELP_LINK "http://www.creatis.insa-lyon.fr/rio/vv")
   SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.creatis.insa-lyon.fr/rio")
   SET(CPACK_NSIS_CONTACT "vv@creatis.insa-lyon.fr")
-  SET(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\vv.lnk\\\" \\\"$INSTDIR\\\\vv.exe\\\" ")
+  SET(CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\vv.lnk\\\" \\\"$INSTDIR\\\\bin\\\\vv.exe\\\" ")
   SET(CPACK_NSIS_DELETE_ICONS_EXTRA "Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\vv.lnk\\\" ")
   #SET(CPACK_NSIS_MODIFY_PATH ON) SR: buggy, wait for cmake updates for a fix
   #SET(CPACK_BINARY_ZIP ON)
index 17d4e8ffa21d51799a57088106f3d78b050129e4..b0b8d39d879bbff1b9faed78be1c21baaf00dfdb 100644 (file)
@@ -58,7 +58,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="1" column="0">
+       <item row="2" column="0">
         <widget class="QLabel" name="dimensionStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -75,7 +75,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="1" column="1">
+       <item row="2" column="1">
         <widget class="QLabel" name="dimensionLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -88,7 +88,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="2" column="0">
+       <item row="3" column="0">
         <widget class="QLabel" name="sizePixelStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -105,7 +105,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="2" column="1">
+       <item row="3" column="1">
         <widget class="QLabel" name="sizePixelLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -118,7 +118,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="3" column="0">
+       <item row="4" column="0">
         <widget class="QLabel" name="sizeMMStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -135,7 +135,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="3" column="1">
+       <item row="4" column="1">
         <widget class="QLabel" name="sizeMMLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -148,7 +148,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="4" column="0">
+       <item row="5" column="0">
         <widget class="QLabel" name="originStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -165,7 +165,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="4" column="1">
+       <item row="5" column="1">
         <widget class="QLabel" name="originLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -178,7 +178,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="5" column="0">
+       <item row="6" column="0">
         <widget class="QLabel" name="spacingStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -195,7 +195,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="5" column="1">
+       <item row="6" column="1">
         <widget class="QLabel" name="spacingLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -208,7 +208,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="6" column="0">
+       <item row="7" column="0">
         <widget class="QLabel" name="nPixelStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -224,7 +224,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="6" column="1">
+       <item row="7" column="1">
         <widget class="QLabel" name="nPixelLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -237,7 +237,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="7" column="0">
+       <item row="8" column="0">
         <widget class="QLabel" name="mouseStaticLabel_2">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -253,14 +253,14 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="7" column="1">
+       <item row="8" column="1">
         <widget class="QLabel" name="mouseLabel">
          <property name="text">
           <string/>
          </property>
         </widget>
        </item>
-       <item row="8" column="0">
+       <item row="9" column="0">
         <widget class="QLabel" name="pixelPosStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -276,7 +276,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="8" column="1">
+       <item row="9" column="1">
         <widget class="QLabel" name="pixelPosLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -289,7 +289,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="9" column="0">
+       <item row="10" column="0">
         <widget class="QLabel" name="worldPosStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -305,7 +305,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="9" column="1">
+       <item row="10" column="1">
         <widget class="QLabel" name="worldPosLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -318,7 +318,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="10" column="0">
+       <item row="11" column="0">
         <widget class="QLabel" name="valueStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -334,7 +334,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="10" column="1">
+       <item row="11" column="1">
         <widget class="QLabel" name="valueLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -347,14 +347,14 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="11" column="1">
+       <item row="12" column="1">
         <widget class="QLabel" name="ViewsLabel">
          <property name="text">
           <string/>
          </property>
         </widget>
        </item>
-       <item row="15" column="0" colspan="2">
+       <item row="16" column="0" colspan="2">
         <widget class="QLabel" name="transformationLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@@ -376,7 +376,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="13" column="0">
+       <item row="14" column="0">
         <widget class="QLabel" name="TransformationStaticLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
@@ -393,7 +393,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="17" column="0">
+       <item row="18" column="0">
         <widget class="QLabel" name="memoryUsageLabel">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@@ -417,7 +417,7 @@ p, li { white-space: pre-wrap; }
          </property>
         </widget>
        </item>
-       <item row="12" column="0">
+       <item row="13" column="0">
         <spacer name="verticalSpacer">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
@@ -430,6 +430,39 @@ p, li { white-space: pre-wrap; }
          </property>
         </spacer>
        </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="creationTimeStaticLabel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="mouseTracking">
+          <bool>true</bool>
+         </property>
+         <property name="text">
+          <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
+&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+p, li { white-space: pre-wrap; }
+&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
+&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;  Creation time :&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="QLabel" name="creationTimeLabel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
     </widget>
index 67a467dd820c0f681cba79b8806956c7f61b6770..b80a782fc5bf38ab4ffc8a5d368be9db249eda0d 100644 (file)
          </sizepolicy>
         </property>
         <property name="currentIndex">
-         <number>1</number>
+         <number>0</number>
         </property>
         <widget class="QWidget" name="DataTab">
          <attribute name="title">
index a801ba0c27862f3957d87f59eeba766ff75bf9ac..b4a4a3df204dfcd5ce4980939010c8bfd1bd756f 100644 (file)
@@ -314,12 +314,23 @@ void vvBinaryImageOverlayActor::ComputeExtent(int orientation,
 //----------------------------------------------------------------------------
 void vvBinaryImageOverlayActor::ComputeExtent(int * inExtent, int * outExtent, vtkImageData * image, vtkImageData * overlay)
 {
+  for(int i=0; i<3; i++) {
+    double a = (image->GetOrigin()[i] + inExtent[i*2]*image->GetSpacing()[i] - 
+                overlay->GetOrigin()[i]) / overlay->GetSpacing()[i];
+    double b = (image->GetOrigin()[i] + inExtent[i*2+1]*image->GetSpacing()[i] - 
+                overlay->GetOrigin()[i]) / overlay->GetSpacing()[i];
+    outExtent[i*2] = lrint(a);
+    outExtent[i*2+1] = lrint(b);
+  }
+
+  /* // FIXME (original)
   outExtent[0] = (int)lrint(((image->GetOrigin()[0] + inExtent[0]*image->GetSpacing()[0]) - overlay->GetOrigin()[0]) / overlay->GetSpacing()[0]);
   outExtent[1] = (int)lrint(((image->GetOrigin()[0] + inExtent[1]*image->GetSpacing()[0]) - overlay->GetOrigin()[0]) / overlay->GetSpacing()[0]);
   outExtent[2] = (int)lrint(((image->GetOrigin()[1] + inExtent[2]*image->GetSpacing()[1]) - overlay->GetOrigin()[1]) / overlay->GetSpacing()[1]);
   outExtent[3] = (int)lrint(((image->GetOrigin()[1] + inExtent[3]*image->GetSpacing()[1]) - overlay->GetOrigin()[1]) / overlay->GetSpacing()[1]);
   outExtent[4] = (int)lrint(((image->GetOrigin()[2] + inExtent[4]*image->GetSpacing()[2]) - overlay->GetOrigin()[2]) / overlay->GetSpacing()[2]);
   outExtent[5] = (int)lrint(((image->GetOrigin()[2] + inExtent[5]*image->GetSpacing()[2]) - overlay->GetOrigin()[2]) / overlay->GetSpacing()[2]);
+  */
 }
 //----------------------------------------------------------------------------
 
index 9aa3e57f448a66a64a42b1b660a49de6174382ac..2a4d1032b531c34c8fa2f39b3ed7836801e0697c 100644 (file)
@@ -52,6 +52,10 @@ void vvInfoPanel::setFileName(QString text)
 }
 //------------------------------------------------------------------------------
 
+void vvInfoPanel::setImageCreationTime(QString text)
+{
+  creationTimeLabel->setText(text);
+}
 
 //------------------------------------------------------------------------------
 void vvInfoPanel::setDimension(QString text)
index 4a665e1aaa34ba09029fa843a5130cf5feabc43c..6db1e9bb4a4059ebf542d1fa8e0b5ed0554edb65 100644 (file)
@@ -32,6 +32,7 @@ public:
 
     void setTransformation(QString text);
     void setFileName(QString text);
+    void setImageCreationTime(QString text);
     void setSizeMM(QString text);
     void setOrigin(QString text);
     void setSpacing(QString text);
index 34e66ada5ba799c0ac7d3ad173cc3fed3642236d..ca0f542989b9fb6f715de7b8c483e38554d4c30e 100644 (file)
@@ -739,7 +739,7 @@ void vvMainWindow::OpenDicom()
 {
   std::vector<std::string> files;
 
-  std::cout << "dicomSeriesSelector " << std::endl;
+  //std::cout << "dicomSeriesSelector " << std::endl;
   if (dicomSeriesSelector->exec() == QDialog::Accepted) {
     files = *(dicomSeriesSelector->GetFilenames());
     LoadImages(files, vvImageReader::DICOM);
@@ -1134,6 +1134,9 @@ void vvMainWindow::ImageInfoChanged()
     dim += pixelType + ")";
 
     infoPanel->setFileName(image);
+    std::string creationImageTimeValue("No creation time");
+    itk::ExposeMetaData< std::string > (*imageSelected->GetFirstMetaDataDictionary(), "creationImageTime", creationImageTimeValue);
+    infoPanel->setImageCreationTime(QString(creationImageTimeValue.c_str()));
     infoPanel->setDimension(dim);
     infoPanel->setSizePixel(GetVectorIntAsString(inputSize));
     infoPanel->setSizeMM(GetVectorDoubleAsString(sizeMM));
index 30a8f1034931e169815e884c2ada69129a72ae4c..ed53d2c83b138c600eeabf680da7edd775854cbc 100644 (file)
@@ -155,6 +155,7 @@ vvSlicer::vvSlicer()
   mConcatenatedTransform = vtkSmartPointer<vtkTransform>::New();
   mConcatenatedFusionTransform = vtkSmartPointer<vtkTransform>::New();
   mConcatenatedOverlayTransform = vtkSmartPointer<vtkTransform>::New();
+  mFirstSetSliceOrientation = true;
 }
 //------------------------------------------------------------------------------
 
@@ -853,15 +854,17 @@ void vvSlicer::SetSliceOrientation(int orientation)
   // DDV(cursorPos, 3);
   // SetCurrentPosition(cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]);
 
-  if (this->Renderer && this->GetInput()) {
+  if (mFirstSetSliceOrientation) {
+    int *range = this->GetSliceRange();
+    if (range)
+      this->Slice = static_cast<int>((range[0] + range[1]) * 0.5);
+    mFirstSetSliceOrientation = false;
+  }
+  else if (this->Renderer && this->GetInput()) {
     double s = mCursor[orientation];
     double sCursor = (s - this->GetInput()->GetOrigin()[orientation])/this->GetInput()->GetSpacing()[orientation];
     this->Slice = static_cast<int>(sCursor);
   }
-  
-//   int *range = this->GetSliceRange();
-//   if (range)
-//     this->Slice = static_cast<int>((range[0] + range[1]) * 0.5);
 
   this->UpdateOrientation();
   this->UpdateDisplayExtent();
index 570c43ddcbd83b027fab6b7ac7f2a87f7e0c453a..0bffd1f36abcc46f92d5b43a3c51aab519685e59 100644 (file)
@@ -297,5 +297,6 @@ private:
   bool mOverlayVisibility;
   bool mFusionVisibility;
   bool mVFVisibility;
+  bool mFirstSetSliceOrientation;
 };
 #endif