From: Brent Huisman Date: Tue, 15 Sep 2015 13:42:23 +0000 (+0200) Subject: Merge branch 'master' of git://git.creatis.insa-lyon.fr/clitk X-Git-Tag: v1.4.0~95 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=308795c2168452ab215acf39633f4cb8d3fc7e71;hp=283688da993869a0f0d092ad44651a306aff97fc;p=clitk.git Merge branch 'master' of git://git.creatis.insa-lyon.fr/clitk --- diff --git a/common/rtkEdfImageIO.cxx b/common/rtkEdfImageIO.cxx index ed3cf10..48acefb 100644 --- a/common/rtkEdfImageIO.cxx +++ b/common/rtkEdfImageIO.cxx @@ -128,7 +128,7 @@ void rtk::EdfImageIO::ReadImageInformation() << "\""); } datalen = edf_datatype_table[k].sajzof; - switch(k) { + switch(edf_datatype_table[k].value) { case U_CHAR_DATATYPE: SetComponentType(itk::ImageIOBase::UCHAR); break; @@ -148,10 +148,10 @@ void rtk::EdfImageIO::ReadImageInformation() SetComponentType(itk::ImageIOBase::INT); break; case U_L_INT_DATATYPE: - SetComponentType(itk::ImageIOBase::ULONG); + SetComponentType(itk::ImageIOBase::UINT); break; case L_INT_DATATYPE: - SetComponentType(itk::ImageIOBase::LONG); + SetComponentType(itk::ImageIOBase::INT); break; case FLOAT_DATATYPE: SetComponentType(itk::ImageIOBase::FLOAT); @@ -203,7 +203,12 @@ void rtk::EdfImageIO::ReadImageInformation() double spacing = 1.; if ( (p = edf_findInHeader(header, "optic_used") ) ) + { spacing = atof(p); + if(spacing == 0.) + spacing = 1.; + } + free(header); gzclose(inp); @@ -259,8 +264,8 @@ void rtk::EdfImageIO::Read(void * buffer) 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( unsigned int, UINT ) + else if itkReadRawBytesAfterSwappingMacro( int, INT ) else if itkReadRawBytesAfterSwappingMacro( float, FLOAT ) else if itkReadRawBytesAfterSwappingMacro( double, DOUBLE ); } @@ -268,19 +273,19 @@ void rtk::EdfImageIO::Read(void * buffer) //-------------------------------------------------------------------- // Write Image Information -void rtk::EdfImageIO::WriteImageInformation(bool keepOfStream) +void rtk::EdfImageIO::WriteImageInformation( bool itkNotUsed(keepOfStream) ) { } //-------------------------------------------------------------------- // Write Image Information -bool rtk::EdfImageIO::CanWriteFile(const char* FileNameToWrite) +bool rtk::EdfImageIO::CanWriteFile( const char* itkNotUsed(FileNameToWrite) ) { return false; } //-------------------------------------------------------------------- // Write Image -void rtk::EdfImageIO::Write(const void * buffer) +void rtk::EdfImageIO::Write( const void * itkNotUsed(buffer) ) { } //// diff --git a/common/rtkEdfImageIO.h b/common/rtkEdfImageIO.h index e865014..83823cb 100644 --- a/common/rtkEdfImageIO.h +++ b/common/rtkEdfImageIO.h @@ -86,9 +86,9 @@ protected: }; /* Note - compatibility: - Unsigned8 = 1, Signed8, Unsigned16, Signed16, - Unsigned32, Signed32, Unsigned64, Signed64, - FloatIEEE32, DoubleIEEE64 + Unsigned8 = 1,Signed8, Unsigned16, Signed16, + Unsigned32, Signed32, Unsigned64, Signed64, + FloatIEEE32, DoubleIEEE64 */ /*************************************************************************** @@ -138,8 +138,8 @@ protected: // * of the matrix in the data file.) // */ //enum EdfRasterAxes { - // RASTER_AXES_XrightYdown, // matricial format: rows, columns - // RASTER_AXES_XrightYup // cartesian coordinate system + //RASTER_AXES_XrightYdown, // matricial format: rows, columns + //RASTER_AXES_XrightYup // cartesian coordinate system // // other 6 combinations not available (not needed until now) //}; diff --git a/common/rtkHisImageIO.cxx b/common/rtkHisImageIO.cxx index 04a6e46..af0cc58 100644 --- a/common/rtkHisImageIO.cxx +++ b/common/rtkHisImageIO.cxx @@ -128,66 +128,13 @@ void rtk::HisImageIO::Read(void * buffer) } //-------------------------------------------------------------------- -bool rtk::HisImageIO::CanWriteFile(const char* FileNameToWrite) +bool rtk::HisImageIO::CanWriteFile( const char* itkNotUsed(FileNameToWrite) ) { - return CanReadFile(FileNameToWrite); + return false; } //-------------------------------------------------------------------- // Write Image -void rtk::HisImageIO::Write(const void* buffer) +void rtk::HisImageIO::Write( const void* itkNotUsed(buffer) ) { - std::ofstream file(m_FileName.c_str(), std::ios::out | std::ios::binary); - - if ( file.fail() ) - itkGenericExceptionMacro(<< "Could not open file (for writing): " << m_FileName); - - m_HeaderSize = HEADER_INFO_SIZE + 32; - unsigned char szHeader[HEADER_INFO_SIZE + 32] = { - 0x00, 0x70, 0x44, 0x00, 0x64, 0x00, 0x64, 0x00, 0x20, 0x00, 0x20, 0x00, 0x01, 0x00, 0x01, 0x00, - 0x00, 0x04, 0x00, 0x04, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6A, 0x18, 0x41, - 0x04, 0x00, 0x40, 0x5F, 0x48, 0x01, 0x40, 0x00, 0x86, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x63, 0x13, 0x00, 0xE8, 0x51, 0x13, 0x00, 0x5C, 0xE7, 0x12, 0x00, - 0xFE, 0x2A, 0x49, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00 - }; - - /* Fill into the header the essentials - The 'iheader' in previous module is fixed to 0x20, and is included in szHeader. - The 'ulx' and 'uly' are fixed to 0x01, so that 'brx' and 'bry' reflect the dimensions of - the image. - */ - const unsigned int ndim = GetNumberOfDimensions(); - if ( (ndim < 2) || (ndim > 3) ) - itkExceptionMacro( <<"Only 2D or 3D support"); - - szHeader[16] = (char)(GetDimensions(0) % 256); // X-size lsb - szHeader[17] = (char)(GetDimensions(0) / 256); // X-size msb - szHeader[18] = (char)(GetDimensions(1) % 256); // Y-size lsb - szHeader[19] = (char)(GetDimensions(1) / 256); // Y-size msb - if (ndim == 3) { - szHeader[20] = (char)(GetDimensions(0) % 256); // NbFrames lsb - szHeader[21] = (char)(GetDimensions(0) / 256); // NbFrames msb - } - - switch (GetComponentType()) - { - case itk::ImageIOBase::USHORT: - szHeader[32] = 4; - break; - //case AVS_TYPE_INTEGER: - // szHeader[32] = 8; - // break; - //case AVS_TYPE_REAL: - // szHeader[32] = 16; - // break; - default: - itkExceptionMacro(<< "Unsupported field type"); - break; - } - - file.write((const char *)szHeader, m_HeaderSize); - file.write( (const char *)buffer, GetImageSizeInBytes() ); - file.close(); } //// diff --git a/common/rtkHndImageIO.cxx b/common/rtkHndImageIO.cxx index 4791fd7..61152b0 100644 --- a/common/rtkHndImageIO.cxx +++ b/common/rtkHndImageIO.cxx @@ -133,16 +133,16 @@ void rtk::HndImageIO::Read(void * buffer) { FILE *fp; - itk::uint32_t* buf = (itk::uint32_t*)buffer; + itk::uint32_t *buf = (itk::uint32_t*)buffer; unsigned char *pt_lut; - itk::uint32_t a; + itk::uint32_t a; unsigned char v; int lut_idx, lut_off; size_t num_read; char dc; short ds; long dl, diff=0; - itk::uint32_t i; + itk::uint32_t i; fp = fopen (m_FileName.c_str(), "rb"); if (fp == NULL) diff --git a/common/rtkImagXImageIO.h b/common/rtkImagXImageIO.h index 8188b04..bbdc6a8 100644 --- a/common/rtkImagXImageIO.h +++ b/common/rtkImagXImageIO.h @@ -69,4 +69,3 @@ protected: } // end namespace #endif - diff --git a/common/rtkImagXImageIOFactory.cxx b/common/rtkImagXImageIOFactory.cxx index 47520a9..fd6fcc0 100644 --- a/common/rtkImagXImageIOFactory.cxx +++ b/common/rtkImagXImageIOFactory.cxx @@ -27,4 +27,3 @@ rtk::ImagXImageIOFactory::ImagXImageIOFactory() 1, itk::CreateObjectFunction::New() ); } - diff --git a/common/rtkImagXImageIOFactory.h b/common/rtkImagXImageIOFactory.h index 5170d45..2466e9d 100644 --- a/common/rtkImagXImageIOFactory.h +++ b/common/rtkImagXImageIOFactory.h @@ -54,7 +54,7 @@ public: itkFactorylessNewMacro(Self); /** Run-time type information (and related methods). */ - itkTypeMacro(EsrfHstImageIOFactory, ObjectFactoryBase); + itkTypeMacro(ImagXImageIOFactory, ObjectFactoryBase); /** Register one factory of this type */ static void RegisterOneFactory(void) { @@ -75,4 +75,3 @@ private: } // end namespace #endif - diff --git a/common/rtkImagXLookupTableImageFilter.h b/common/rtkImagXLookupTableImageFilter.h deleted file mode 100644 index c6271cc..0000000 --- a/common/rtkImagXLookupTableImageFilter.h +++ /dev/null @@ -1,97 +0,0 @@ -/*========================================================================= - * - * 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 __rtkImagXLookupTableImageFilter_h -#define __rtkImagXLookupTableImageFilter_h - -#include "rtkLookupTableImageFilter.h" -#include - -namespace rtk -{ - -/** \class ImagXLookupTableImageFilter - * \brief Lookup table for ImagX data. - * - * The lookup table converts the raw values measured by the panel to the - * logarithm of the value divided by the maximum numerical value. This could - * be improved with a calibration of the air value. - * - * \author Simon Rit - * - * \ingroup ImageToImageFilter - */ -template -class ITK_EXPORT ImagXLookupTableImageFilter : public LookupTableImageFilter -{ - -public: - /** Standard class typedefs. */ - typedef ImagXLookupTableImageFilter Self; - typedef LookupTableImageFilter Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - typedef typename TInputImage::PixelType InputImagePixelType; - typedef typename TOutputImage::PixelType OutputImagePixelType; - typedef typename Superclass::FunctorType::LookupTableType LookupTableType; - - /** Method for creation through the object factory. */ - itkNewMacro(Self); - - /** Runtime information support. */ - itkTypeMacro(ImagXLookupTableImageFilter, LookupTableImageFilter); -protected: - ImagXLookupTableImageFilter(); - virtual ~ImagXLookupTableImageFilter() { - } - -private: - ImagXLookupTableImageFilter(const Self&); //purposely not implemented - void operator=(const Self&); //purposely not implemented - -}; - -} // end namespace rtk - -template -rtk::ImagXLookupTableImageFilter::ImagXLookupTableImageFilter() -{ - // Create the lut - typename LookupTableType::Pointer lut = LookupTableType::New(); - typename LookupTableType::SizeType size; - size[0] = itk::NumericTraits::max()-itk::NumericTraits::min()+1; - lut->SetRegions( size ); - lut->Allocate(); - - OutputImagePixelType logRef = log(OutputImagePixelType(size[0]) ); - - // Iterate and set lut - itk::ImageRegionIteratorWithIndex it( lut, lut->GetBufferedRegion() ); - it.GoToBegin(); - while( !it.IsAtEnd() ) - { - it.Set( logRef - log(it.GetIndex()[0]+1.) ); - ++it; - } - - // Set the lut to member and functor - this->SetLookupTable(lut); -} - -#endif diff --git a/common/rtkImagXRawToAttenuationImageFilter.h b/common/rtkImagXRawToAttenuationImageFilter.h deleted file mode 100644 index 6ee663a..0000000 --- a/common/rtkImagXRawToAttenuationImageFilter.h +++ /dev/null @@ -1,94 +0,0 @@ -/*========================================================================= - * - * 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 __rtkImagXRawToAttenuationImageFilter_h -#define __rtkImagXRawToAttenuationImageFilter_h - -#include -#include - -#include "rtkImagXLookupTableImageFilter.h" -#include "rtkBoellaardScatterCorrectionImageFilter.h" - -/** \class ImagXRawToAttenuationImageFilter - * \brief Convert raw ImagX data to attenuation images - * - * TODO - * - * \author Simon Rit - * - * \ingroup ImageToImageFilter - */ -namespace rtk -{ - -template -class ITK_EXPORT ImagXRawToAttenuationImageFilter : - public itk::ImageToImageFilter -{ -public: - /** Standard class typedefs. */ - typedef ImagXRawToAttenuationImageFilter Self; - typedef itk::ImageToImageFilter Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - /** Some convenient typedefs. */ - typedef TInputImage InputImageType; - typedef TOutputImage OutputImageType; - - /** Standard New method. */ - itkNewMacro(Self); - - /** Runtime information support. */ - itkTypeMacro(ImagXRawToAttenuationImageFilter, itk::ImageToImageFilter); -protected: - ImagXRawToAttenuationImageFilter(); - ~ImagXRawToAttenuationImageFilter(){ - } - - /** Apply changes to the input image requested region. */ - virtual void GenerateInputRequestedRegion(); - - void GenerateOutputInformation(); - - /** Single-threaded version of GenerateData. This filter delegates - * to other filters. */ - void GenerateData(); - -private: - //purposely not implemented - ImagXRawToAttenuationImageFilter(const Self&); - void operator=(const Self&); - - typedef itk::CropImageFilter CropFilterType; - typedef rtk::BoellaardScatterCorrectionImageFilter ScatterFilterType; - typedef rtk::ImagXLookupTableImageFilter LookupTableFilterType; - - typename LookupTableFilterType::Pointer m_LookupTableFilter; - typename CropFilterType::Pointer m_CropFilter; - typename ScatterFilterType::Pointer m_ScatterFilter; -}; // end of class - -} // end namespace rtk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "rtkImagXRawToAttenuationImageFilter.txx" -#endif - -#endif diff --git a/common/rtkImagXRawToAttenuationImageFilter.txx b/common/rtkImagXRawToAttenuationImageFilter.txx deleted file mode 100644 index 5e02cee..0000000 --- a/common/rtkImagXRawToAttenuationImageFilter.txx +++ /dev/null @@ -1,85 +0,0 @@ -/*========================================================================= - * - * 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 __rtkImagXRawToAttenuationImageFilter_txx -#define __rtkImagXRawToAttenuationImageFilter_txx - -#include - -namespace rtk -{ - -template -void -ImagXRawToAttenuationImageFilter -::GenerateInputRequestedRegion() -{ - typename Superclass::InputImagePointer inputPtr = - const_cast< TInputImage * >( this->GetInput() ); - if ( !inputPtr ) - return; - - m_CropFilter->SetInput(inputPtr); //SR: this is most likely useless - m_LookupTableFilter->GetOutput()->SetRequestedRegion(this->GetOutput()->GetRequestedRegion() ); - m_LookupTableFilter->GetOutput()->PropagateRequestedRegion(); -} - -template -ImagXRawToAttenuationImageFilter -::ImagXRawToAttenuationImageFilter() -{ - m_CropFilter = CropFilterType::New(); - m_ScatterFilter = ScatterFilterType::New(); - m_LookupTableFilter = LookupTableFilterType::New(); - - //Permanent internal connections - m_ScatterFilter->SetInput( m_CropFilter->GetOutput() ); - m_LookupTableFilter->SetInput( m_ScatterFilter->GetOutput() ); - - //Default filter parameters - typename CropFilterType::SizeType border = m_CropFilter->GetLowerBoundaryCropSize(); - border[0] = 4; - border[1] = 4; - m_CropFilter->SetBoundaryCropSize(border); -} - -template -void -ImagXRawToAttenuationImageFilter -::GenerateOutputInformation() -{ - m_CropFilter->SetInput(this->GetInput() ); - m_LookupTableFilter->UpdateOutputInformation(); - this->GetOutput()->SetOrigin( m_LookupTableFilter->GetOutput()->GetOrigin() ); - this->GetOutput()->SetSpacing( m_LookupTableFilter->GetOutput()->GetSpacing() ); - this->GetOutput()->SetDirection( m_LookupTableFilter->GetOutput()->GetDirection() ); - this->GetOutput()->SetLargestPossibleRegion( m_LookupTableFilter->GetOutput()->GetLargestPossibleRegion() ); -} - -template -void -ImagXRawToAttenuationImageFilter -::GenerateData() -{ - m_CropFilter->SetInput(this->GetInput() ); - m_LookupTableFilter->Update(); - this->GraftOutput( m_LookupTableFilter->GetOutput() ); -} - -} // end namespace rtk -#endif diff --git a/common/rtkImagXXMLFileReader.cxx b/common/rtkImagXXMLFileReader.cxx index f415f0d..551dee1 100644 --- a/common/rtkImagXXMLFileReader.cxx +++ b/common/rtkImagXXMLFileReader.cxx @@ -94,7 +94,7 @@ StartElement(const char * name, const char ** atts) void ImagXXMLFileReader:: -EndElement(const char *name) +EndElement( const char *itkNotUsed(name) ) { } diff --git a/common/rtkXRadImageIO.cxx b/common/rtkXRadImageIO.cxx index db5eb72..fb02952 100644 --- a/common/rtkXRadImageIO.cxx +++ b/common/rtkXRadImageIO.cxx @@ -37,13 +37,13 @@ void rtk::XRadImageIO::ReadImageInformation() { std::string line; std::getline(is, line); - if(line.find('[')!=std::string::npos) + 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) + if(line.find('=') != std::string::npos) { unsigned int pos = line.find('='); std::string paramName = line.substr(0,pos); @@ -57,9 +57,9 @@ void rtk::XRadImageIO::ReadImageInformation() SetDimensions(2, atoi(paramValue.c_str())); else if(paramName == std::string("CBCT.DimensionalAttributes.DataSize")) { - if(atoi(paramValue.c_str())==3) + if(atoi(paramValue.c_str()) == 3) SetComponentType(itk::ImageIOBase::FLOAT); - if(atoi(paramValue.c_str())==6) + if(atoi(paramValue.c_str()) == 6) SetComponentType(itk::ImageIOBase::USHORT); } else if(paramName == std::string("CBCT.DimensionalAttributes.PixelDimension_I_cm")) @@ -143,19 +143,19 @@ void rtk::XRadImageIO::Read(void * buffer) //-------------------------------------------------------------------- // Write Image Information -void rtk::XRadImageIO::WriteImageInformation(bool keepOfStream) +void rtk::XRadImageIO::WriteImageInformation(bool itkNotUsed(keepOfStream)) { } //-------------------------------------------------------------------- // Write Image Information -bool rtk::XRadImageIO::CanWriteFile(const char* FileNameToWrite) +bool rtk::XRadImageIO::CanWriteFile(const char* itkNotUsed(FileNameToWrite)) { return false; } //-------------------------------------------------------------------- // Write Image -void rtk::XRadImageIO::Write(const void * buffer) +void rtk::XRadImageIO::Write(const void * itkNotUsed(buffer)) { } //// diff --git a/superbuild/CMakeLists.txt b/superbuild/CMakeLists.txt index 988c1c1..fad0b95 100644 --- a/superbuild/CMakeLists.txt +++ b/superbuild/CMakeLists.txt @@ -50,7 +50,7 @@ endif() ExternalProject_Add( QT SOURCE_DIR ${source_prefix}/qt - GIT_REPOSITORY git://gitorious.org/qt/qt.git + GIT_REPOSITORY git://code.qt.io/qt/qt.git GIT_TAG v4.8.6 PATCH_COMMAND ${WINPATCH} CONFIGURE_COMMAND ${source_prefix}/qt/configure -confirm-license