<< "\"");
}
datalen = edf_datatype_table[k].sajzof;
- switch(k) {
+ switch(edf_datatype_table[k].value) {
case U_CHAR_DATATYPE:
SetComponentType(itk::ImageIOBase::UCHAR);
break;
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);
double spacing = 1.;
if ( (p = edf_findInHeader(header, "optic_used") ) )
+ {
spacing = atof(p);
+ if(spacing == 0.)
+ spacing = 1.;
+ }
+
free(header);
gzclose(inp);
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 );
}
//--------------------------------------------------------------------
// 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) )
{
} ////
};
/* Note - compatibility:
- Unsigned8 = 1, Signed8, Unsigned16, Signed16,
- Unsigned32, Signed32, Unsigned64, Signed64,
- FloatIEEE32, DoubleIEEE64
+ Unsigned8 = 1,Signed8, Unsigned16, Signed16,
+ Unsigned32, Signed32, Unsigned64, Signed64,
+ FloatIEEE32, DoubleIEEE64
*/
/***************************************************************************
// * 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)
//};
}
//--------------------------------------------------------------------
-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();
} ////
{
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)
} // end namespace
#endif
-
1,
itk::CreateObjectFunction<ImagXImageIO>::New() );
}
-
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) {
} // 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.
- *
- *=========================================================================*/
-
-#ifndef __rtkImagXLookupTableImageFilter_h
-#define __rtkImagXLookupTableImageFilter_h
-
-#include "rtkLookupTableImageFilter.h"
-#include <itkNumericTraits.h>
-
-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 TInputImage, class TOutputImage>
-class ITK_EXPORT ImagXLookupTableImageFilter : public LookupTableImageFilter<TInputImage, TOutputImage>
-{
-
-public:
- /** Standard class typedefs. */
- typedef ImagXLookupTableImageFilter Self;
- typedef LookupTableImageFilter<TInputImage, TOutputImage> Superclass;
- typedef itk::SmartPointer<Self> Pointer;
- typedef itk::SmartPointer<const Self> 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 <class TInputImage, class TOutputImage>
-rtk::ImagXLookupTableImageFilter<TInputImage, TOutputImage>::ImagXLookupTableImageFilter()
-{
- // Create the lut
- typename LookupTableType::Pointer lut = LookupTableType::New();
- typename LookupTableType::SizeType size;
- size[0] = itk::NumericTraits<InputImagePixelType>::max()-itk::NumericTraits<InputImagePixelType>::min()+1;
- lut->SetRegions( size );
- lut->Allocate();
-
- OutputImagePixelType logRef = log(OutputImagePixelType(size[0]) );
-
- // Iterate and set lut
- itk::ImageRegionIteratorWithIndex<LookupTableType> 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
+++ /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 __rtkImagXRawToAttenuationImageFilter_h
-#define __rtkImagXRawToAttenuationImageFilter_h
-
-#include <itkImageToImageFilter.h>
-#include <itkCropImageFilter.h>
-
-#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 TInputImage, class TOutputImage=TInputImage>
-class ITK_EXPORT ImagXRawToAttenuationImageFilter :
- public itk::ImageToImageFilter<TInputImage, TOutputImage>
-{
-public:
- /** Standard class typedefs. */
- typedef ImagXRawToAttenuationImageFilter Self;
- typedef itk::ImageToImageFilter<TInputImage, TOutputImage> Superclass;
- typedef itk::SmartPointer<Self> Pointer;
- typedef itk::SmartPointer<const Self> 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<InputImageType, InputImageType> CropFilterType;
- typedef rtk::BoellaardScatterCorrectionImageFilter<InputImageType, InputImageType> ScatterFilterType;
- typedef rtk::ImagXLookupTableImageFilter<InputImageType, OutputImageType> 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
+++ /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 __rtkImagXRawToAttenuationImageFilter_txx
-#define __rtkImagXRawToAttenuationImageFilter_txx
-
-#include <itkImageFileWriter.h>
-
-namespace rtk
-{
-
-template<class TInputImage, class TOutputImage>
-void
-ImagXRawToAttenuationImageFilter<TInputImage, TOutputImage>
-::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 <class TInputImage, class TOutputImage>
-ImagXRawToAttenuationImageFilter<TInputImage, TOutputImage>
-::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<class TInputImage, class TOutputImage>
-void
-ImagXRawToAttenuationImageFilter<TInputImage, TOutputImage>
-::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<class TInputImage, class TOutputImage>
-void
-ImagXRawToAttenuationImageFilter<TInputImage, TOutputImage>
-::GenerateData()
-{
- m_CropFilter->SetInput(this->GetInput() );
- m_LookupTableFilter->Update();
- this->GraftOutput( m_LookupTableFilter->GetOutput() );
-}
-
-} // end namespace rtk
-#endif
void
ImagXXMLFileReader::
-EndElement(const char *name)
+EndElement( const char *itkNotUsed(name) )
{
}
{
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);
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"))
//--------------------------------------------------------------------
// 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))
{
} ////