8 #pragma warning ( disable : 4786 ) 11 #include "PlusConfigure.h" 19 #include "itkIOCommon.h" 20 #include <itksys/SystemTools.hxx> 22 #include "ulterius_def.h" 53 this->AddSupportedReadExtension(
".b8");
54 this->AddSupportedReadExtension(
".b32");
65 Superclass::PrintSelf(os, indent);
67 os << indent <<
"Number of frames: " <<
m_FileHeaderPtr->frames <<
"\n";
75 std::string fname = filename;
78 itkDebugMacro(<<
"No filename specified.");
108 itkExceptionMacro(
"File cannot be read: " 109 << this->GetFileName() <<
" for reading." 111 <<
"Reason: cannot read header, " 112 << itksys::SystemTools::GetLastSystemError());
119 this->SetNumberOfComponents(1);
120 this->SetPixelType( SCALAR );
121 this->SetComponentType(
CHAR );
124 this->SetNumberOfComponents(3);
125 this->SetPixelType( SCALAR );
126 this->SetComponentType(
CHAR );
130 itkExceptionMacro(
"File cannot be read: " 131 << this->GetFileName() <<
" for reading." 138 itkExceptionMacro(
"File cannot be read: " 139 << this->GetFileName() <<
" for reading." 144 this->SetNumberOfDimensions(3);
152 this->SetSpacing(0, 1.0);
153 this->SetSpacing(1, 1.0);
154 this->SetSpacing(2, 1.0);
156 this->SetOrigin(0, 0);
157 this->SetOrigin(1, 0);
158 this->SetOrigin(2, 0);
160 vnl_vector< double > directionAxis( this->GetNumberOfDimensions() );
162 directionAxis[0]=1.0;
163 directionAxis[1]=0.0;
164 directionAxis[2]=0.0;
165 this->SetDirection( 0, directionAxis );
167 directionAxis[0]=0.0;
168 directionAxis[1]=1.0;
169 directionAxis[2]=0.0;
170 this->SetDirection( 1, directionAxis );
172 directionAxis[0]=0.0;
173 directionAxis[1]=0.0;
174 directionAxis[2]=1.0;
175 this->SetDirection( 2, directionAxis );
183 file.open( m_FileName.c_str(), std::ios::in | std::ios::binary );
186 file.seekg(
sizeof(uFileHeader), std::ios::beg );
188 file.read(static_cast<char*>(buffer), static_cast<std::streamsize>(this->GetImageSizeInBytes()));
212 std::ifstream local_InputStream;
213 local_InputStream.open( filename, std::ios::in | std::ios::binary );
214 if( local_InputStream.fail() )
218 if( ! this->ReadBufferAsBinary( local_InputStream,
220 sizeof(uFileHeader) ) )
222 local_InputStream.close();
225 local_InputStream.close();
void PrintSelf(std::ostream &os, Indent indent) const
bool ReadHeader(const char *filename)
virtual void WriteImageInformation()
virtual bool CanReadFile(const char *)
virtual void Read(void *buffer)
virtual void Write(const void *buffer)
virtual bool CanWriteFile(const char *)
uFileHeader * m_FileHeaderPtr
virtual void ReadImageInformation()