#=========================================================
# 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()
#=========================================================
rtkHndImageIOFactory.cxx
rtkEdfImageIO.cxx
rtkEdfImageIOFactory.cxx
+ rtkXRadImageIO.cxx
+ rtkXRadImageIOFactory.cxx
rtkImagXImageIO.cxx
rtkImagXImageIOFactory.cxx
rtkImagXXMLFileReader.cxx
### 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)
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
}
//--------------------------------------------------------------------
+
+//--------------------------------------------------------------------
+//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 */
/* 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;
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;
//--------------------------------------------------------------------
-void clitk::FilterBase::StartNewStep(std::string s)
+void clitk::FilterBase::StartNewStep(std::string s, bool endl)
{
if (Cancelled()) {
throw clitk::ExceptionObject("Filter is canceled.");
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;
}
}
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();
#include "rtkHndImageIOFactory.h"
#include "rtkEdfImageIOFactory.h"
#include "rtkImagXImageIOFactory.h"
+#include "rtkXRadImageIOFactory.h"
#include "clitkEsrfHstImageIOFactory.h"
#include "clitkGateAsciiImageIOFactory.h"
#include "clitkConfiguration.h"
rtk::HndImageIOFactory::RegisterOneFactory();
rtk::EdfImageIOFactory::RegisterOneFactory();
rtk::ImagXImageIOFactory::RegisterOneFactory();
+ rtk::XRadImageIOFactory::RegisterOneFactory();
clitk::EsrfHstImageIOFactory::RegisterOneFactory();
#if ITK_VERSION_MAJOR >= 4
itk::GDCMImageIOFactory::RegisterOneFactory();
--- /dev/null
+/*=========================================================================
+ *
+ * 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)
+{
+} ////
--- /dev/null
+/*=========================================================================
+ *
+ * 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
--- /dev/null
+/*=========================================================================
+ *
+ * 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() );
+}
--- /dev/null
+/*=========================================================================
+ *
+ * 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
return same;
}
//--------------------------------------------------------------------
+itk::MetaDataDictionary* vvImage::GetFirstMetaDataDictionary()
+{
+ return mDictionary[0];
+}
+//--------------------------------------------------------------------
#endif // VVIMAGE_CXX
void SetTimeSpacing(double s) { mTimeSpacing = s; }
void SetTimeOrigin(double o) { mTimeOrigin = o; }
bool HaveSameSizeAndSpacingThan(vvImage * other);
+ //META DATA
+ itk::MetaDataDictionary* GetFirstMetaDataDictionary();
private:
vvImage();
std::vector< ConverterPointer > mItkToVtkConverters;
std::vector< vtkImageData* > mVtkImages;
std::vector< vtkSmartPointer<vtkTransform> > mTransform;
+ //META DATA
+ std::vector< itk::MetaDataDictionary* > mDictionary;
double mTimeOrigin;
double mTimeSpacing;
mTransform.push_back(vtkSmartPointer<vtkTransform>::New());
mTransform.back()->SetMatrix(matrix);
+ //META DATA
+ mDictionary.push_back(&(input->GetMetaDataDictionary()));
}
//--------------------------------------------------------------------
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
bool m_FuzzyMapOnlyFlag;
bool m_FastFlag;
double m_Radius;
+ double m_K1;
virtual void GenerateOutputInformation();
virtual void GenerateInputRequestedRegion();
FuzzyMapOnlyFlagOff();
FastFlagOff();
SetRadius(2.0);
+ SetK1(vcl_acos(-1.0)/2);
}
//--------------------------------------------------------------------
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();
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()) {
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
extract->SetDirectionCollapseToSubmatrix();
#endif
extract->Update();
- SetNthOutput(i, extract->GetOutput());
+ this->SetNthOutput(i, extract->GetOutput());
}
return;
}
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;
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;
}
//--------------------------------------------------------------------
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();
}
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);
//--------------------------------------------------------------------
++iter;
}
if (!found) return false;
- input->TransformIndexToPhysicalPoint(max, point);
+ input->TransformIndexToPhysicalPoint(max, point); // half of the pixel
return true;
}
//--------------------------------------------------------------------
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);
}
//--------------------------------------------------------------------
// 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);
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);
// 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
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;
}
}
- // 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");
*/
}
//--------------------------------------------------------------------
#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
SetObjectCCLSelectionDirection(1);
ObjectCCLSelectionIgnoreSingleCCLFlagOff();
VerboseSlicesFlagOff();
+ this->SetK1(vcl_acos(-1.0)/2);
}
//--------------------------------------------------------------------
<< "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;
}
//--------------------------------------------------------------------
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();
if (GetVerboseSlicesFlag()) {
std::cout << "Slice " << i << std::endl;
relPosFilter->VerboseStepFlagOn();
+ //relPosFilter->WriteStepFlagOn();
}
relPosFilter->WriteStepFlagOff();
// relPosFilter->VerboseMemoryFlagOn();
// relPosFilter->SetComputeFuzzyMapFlag(this->GetComputeFuzzyMapFlag());
relPosFilter->SetFastFlag(this->GetFastFlag());
relPosFilter->SetRadius(this->GetRadius());
+ relPosFilter->SetK1(this->GetK1());
// Go !
relPosFilter->Update();
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)
ADD_LIBRARY(clitkSegmentationGgoLib
clitkFilterWithAnatomicalFeatureDatabaseManagement.cxx
clitkAnatomicalFeatureDatabase.cxx
+ clitkSliceBySliceRelativePositionFilter_uchar.cxx
${GGO_C_FILES})
#=========================================================
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)
{
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);
}
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);
}
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 ?
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);
filter->SetInput(1, m_reference);
filter->Update();
}
-
+ std::cout << std::endl;
}
}
//--------------------------------------------------------------------
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++)
--- /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://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
-no-libtiff
-no-libjpeg
-no-libmng
+ -no-glib
INSTALL_COMMAND ""
)
SET(qmake_executable "${build_prefix}/QT/bin/qmake")
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)
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)
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 *
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);
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"
===========================================================================**/
#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"
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
++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);
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>();
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, ®, 0);
}
else {
std::cerr << "Mask image has a different size/spacing than input. Abort" << std::endl;
#=========================================================
# 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)
#=========================================================
#=========================================================
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)
# 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)
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</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">
</property>
</widget>
</item>
- <item row="12" column="0">
+ <item row="13" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</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><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:8pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:9pt;"><span style=" font-weight:600;"> Creation time :</span></p></body></html></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>
</sizepolicy>
</property>
<property name="currentIndex">
- <number>1</number>
+ <number>0</number>
</property>
<widget class="QWidget" name="DataTab">
<attribute name="title">
//----------------------------------------------------------------------------
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]);
+ */
}
//----------------------------------------------------------------------------
}
//------------------------------------------------------------------------------
+void vvInfoPanel::setImageCreationTime(QString text)
+{
+ creationTimeLabel->setText(text);
+}
//------------------------------------------------------------------------------
void vvInfoPanel::setDimension(QString text)
void setTransformation(QString text);
void setFileName(QString text);
+ void setImageCreationTime(QString text);
void setSizeMM(QString text);
void setOrigin(QString text);
void setSpacing(QString text);
{
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);
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));
mConcatenatedTransform = vtkSmartPointer<vtkTransform>::New();
mConcatenatedFusionTransform = vtkSmartPointer<vtkTransform>::New();
mConcatenatedOverlayTransform = vtkSmartPointer<vtkTransform>::New();
+ mFirstSetSliceOrientation = true;
}
//------------------------------------------------------------------------------
// 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();
bool mOverlayVisibility;
bool mFusionVisibility;
bool mVFVisibility;
+ bool mFirstSetSliceOrientation;
};
#endif