GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vtkLSMReader.cxx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: BioImageXD
4  Module: $RCSfile: vtkLSMReader.cxx,v $
5  Language: C++
6  Date: $Date: 2003/08/22 14:46:02 $
7  Version: $Revision: 1.39 $
8 
9  This is an open-source copyright as follows:
10  Copyright (c) 2004-2008 BioImageXD Development Team
11 
12  All rights reserved.
13 
14  Redistribution and use in source and binary forms, with or without
15  modification, are permitted provided that the following conditions are met:
16 
17  * Redistributions of source code must retain the above copyright notice,
18  this list of conditions and the following disclaimer.
19 
20  * Redistributions in binary form must reproduce the above copyright notice,
21  this list of conditions and the following disclaimer in the documentation
22  and/or other materials provided with the distribution.
23 
24  * Modified source versions must be plainly marked as such, and must not be
25  misrepresented as being the original software.
26 
27  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
28  IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
31  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  POSSIBILITY OF SUCH DAMAGE.
38 
39 =========================================================================*/
40 
41 /*=========================================================================
42  Modifications were made by the GoFigure Dev. Team.
43  while at Megason Lab, Systems biology, Harvard Medical school, 2009-11
44 
45  Copyright (c) 2009-11, President and Fellows of Harvard College.
46  All rights reserved.
47 
48  Redistribution and use in source and binary forms, with or without
49  modification, are permitted provided that the following conditions are met:
50 
51  Redistributions of source code must retain the above copyright notice,
52  this list of conditions and the following disclaimer.
53  Redistributions in binary form must reproduce the above copyright notice,
54  this list of conditions and the following disclaimer in the documentation
55  and/or other materials provided with the distribution.
56  Neither the name of the President and Fellows of Harvard College
57  nor the names of its contributors may be used to endorse or promote
58  products derived from this software without specific prior written
59  permission.
60 
61  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
62  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
63  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
64  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
65  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
66  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
67  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
68  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
69  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
70  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
71  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
72 
73  =========================================================================*/
74 
75 #include "vtkLSMReader.h"
76 #include "vtkObjectFactory.h"
77 #include "vtkImageData.h"
78 #include "vtkSource.h"
79 #include "vtkPointData.h"
80 #include "vtkByteSwap.h"
81 #include "vtkInformation.h"
82 #include "vtkInformationVector.h"
83 #include "vtkStreamingDemandDrivenPipeline.h"
84 #include <time.h>
85 #include <assert.h>
86 
87 #define PRT_EXT(ext) ext[0], ext[1], ext[2], ext[3], ext[4], ext[5]
88 #define PRT_EXT2(ext) ext[0] << "," << ext[1] << "," << ext[2] << "," << ext[3] << "," << ext[4] << "," << ext[5]
89 
90 #define CLEAR_CODE 256
91 #define EOI_CODE 257
92 
93 //#include "lzw.h"
94 
96 
98 {
99  this->SetNumberOfInputPorts(0);
100  this->SetNumberOfOutputPorts(1);
101  this->ChannelDataTypes = 0;
102  this->TrackWavelengths = 0;
103  this->ImageOffsets = 0;
104  this->ReadSizes = NULL;
105  this->Description = NULL;
106 
107 #ifdef VTK_WORDS_BIGENDIAN
108  this->SwapBytes = true;
109 #else
110  this->SwapBytes = false;
111 #endif
112 
113  this->Clean();
114 }
115 
117 {
118  this->ClearFileName();
119  this->ClearChannelNames();
120  this->ChannelColors->Delete();
121  this->BitsPerSample->Delete();
122  this->StripOffset->Delete();
123  this->StripByteCount->Delete();
124  this->LaserNames->Delete();
125  if ( this->TrackWavelengths )
126  {
127  this->TrackWavelengths->Delete();
128  }
129  if ( this->ChannelDataTypes )
130  {
131  this->ChannelDataTypes->Delete();
132  }
133  if ( this->ImageOffsets )
134  {
135  this->ImageOffsets->Delete();
136  this->ImageOffsets = 0;
137  this->ReadSizes->Delete();
138  this->ReadSizes = 0;
139  }
140  if ( this->TimeStampInformation )
141  {
142  this->TimeStampInformation->Delete();
143  }
144 
145 if(Description)
146  {
147  delete[] Description;
148  Description = NULL;
149  }
150 
151  if(Objective)
152  {
153  delete[] Objective;
154  Objective = NULL;
155  }
156 }
157 
159 {
160  if ( this->File )
161  {
162  this->File->close();
163  delete this->File;
164  this->File = NULL;
165  }
166 
167  if ( this->FileName )
168  {
169  delete[] this->FileName;
170  this->FileName = NULL;
171  }
172 }
173 
174 //----------------------------------------------------------------------------
175 // This function sets the name of the file.
176 void vtkLSMReader::SetFileName(const char *name)
177 {
178  if ( this->FileName && name && ( !strcmp(this->FileName, name) ) )
179  {
180  return;
181  }
182  if ( !name && !this->FileName )
183  {
184  return;
185  }
186  if ( this->FileName )
187  {
188  delete[] this->FileName;
189  }
190  if ( name )
191  {
192  this->FileName = new char[strlen(name) + 1];
193  strcpy(this->FileName, name);
194  }
195  else
196  {
197  this->FileName = NULL;
198  }
200  this->Modified();
201 }
202 
204 {
205  this->IntUpdateExtent[0] = this->IntUpdateExtent[1] = this->IntUpdateExtent[2] = this->IntUpdateExtent[4] = 0;
206  this->IntUpdateExtent[3] = this->IntUpdateExtent[5] = 0;
207 
208  this->DataExtent[0] = this->DataExtent[1] = this->DataExtent[2] = this->DataExtent[4] = 0;
209  this->DataExtent[3] = this->DataExtent[5] = 0;
210  this->OffsetToLastAccessedImage = 0;
211  this->NumberOfLastAccessedImage = 0;
212  this->FileNameChanged = 0;
213  this->FileName = NULL;
214  this->File = NULL;
215  this->VoxelSizes[0] = this->VoxelSizes[1] = this->VoxelSizes[2] = 0.0;
216  this->Identifier = 0;
217 
218  this->LaserNames = vtkStringArray::New();
219  this->TrackWavelengths = vtkDoubleArray::New();
220  this->DataSpacing[0] = this->DataSpacing[1] = this->DataSpacing[2] = 1.0f;
221  this->Dimensions[0] = this->Dimensions[1] = this->Dimensions[2] = this->Dimensions[3] = this->Dimensions[4] = 0;
222  this->NewSubFileType = 0;
223  this->BitsPerSample = vtkUnsignedShortArray::New();
224  this->BitsPerSample->SetNumberOfTuples(4);
225  this->BitsPerSample->SetNumberOfComponents(1);
226  this->Compression = 0;
227  this->StripOffset = vtkUnsignedIntArray::New();
228  this->StripOffset->SetNumberOfTuples(4);
229  this->StripOffset->SetNumberOfComponents(1);
230  this->SamplesPerPixel = 0;
231  this->StripByteCount = vtkUnsignedIntArray::New();
232  this->StripByteCount->SetNumberOfTuples(4);
233  this->StripByteCount->SetNumberOfComponents(1);
234  this->Predictor = 0;
235  this->PhotometricInterpretation = 0;
236  this->PlanarConfiguration = 0;
237  this->ColorMapOffset = 0;
238  this->LSMSpecificInfoOffset = 0;
240  this->NumberOfIntensityValues[2] = this->NumberOfIntensityValues[3] = 0;
241  this->ScanType = 0;
242  this->DataType = 0;
243  this->ChannelColors = vtkIntArray::New();
244  this->ChannelNames = NULL;
245  this->TimeStampInformation = vtkDoubleArray::New();
246 }
247 
249 {
250  if ( !this->FileName )
251  {
252  vtkErrorMacro(<< "FileName must be specified.");
253  return 0;
254  }
255 
256  // Close file from any previous image
257  if ( this->File )
258  {
259  this->File->close();
260  delete this->File;
261  this->File = NULL;
262  }
263 
264  // Open the new file
265 #ifdef _WIN32
266  this->File = new ifstream(this->FileName, ios::in | ios::binary);
267 #else
268  this->File = new ifstream(this->FileName, ios::in);
269 #endif
270  if ( !this->File || this->File->fail() )
271  {
272  vtkErrorMacro(<< "OpenFile: Could not open file " << this->FileName);
273  return 0;
274  }
275  return 1;
276 }
277 
279 {
280 #ifndef VTK_WORDS_BIGENDIAN
281  this->SwapBytesOn();
282 #else
283  this->SwapBytesOff();
284 #endif
285 }
286 
288 {
289 #ifdef VTK_WORDS_BIGENDIAN
290  this->SwapBytesOn();
291 #else
292  this->SwapBytesOff();
293 #endif
294 }
295 
297 {
298  if ( byteOrder == VTK_FILE_BYTE_ORDER_BIG_ENDIAN )
299  {
301  }
302  else
303  {
305  }
306 }
307 
309 {
310 #ifdef VTK_WORDS_BIGENDIAN
311  if ( this->SwapBytes )
312  {
314  }
315  else
316  {
318  }
319 #else
320  if ( this->SwapBytes )
321  {
323  }
324  else
325  {
327  }
328 #endif
329 }
330 
332 {
333 #ifdef VTK_WORDS_BIGENDIAN
334  if ( this->SwapBytes )
335  {
336  return "LittleEndian";
337  }
338  else
339  {
340  return "BigEndian";
341  }
342 #else
343  if ( this->SwapBytes )
344  {
345  return "BigEndian";
346  }
347  else
348  {
349  return "LittleEndian";
350  }
351 #endif
352 }
353 
355 {
356  if ( !this->ChannelNames || chNum < 0 || chNum > this->GetNumberOfChannels() - 1 )
357  {
358  vtkDebugMacro(<< "GetChannelName: Illegal channel index!");
359  //NOTE: would be much easier to return a const char*
360  return const_cast< char * >( std::string("").c_str() );
361  }
362  return this->ChannelNames[chNum];
363 }
364 
366 {
367  vtkDebugMacro(<< "clearing " << this->GetNumberOfChannels() << "channel names");
368  if ( !this->ChannelNames || this->GetNumberOfChannels() < 1 )
369  {
370  return 0;
371  }
372 
373  for ( int i = 0; i < this->GetNumberOfChannels(); i++ )
374  {
375  delete[] this->ChannelNames[i];
376  }
377  vtkDebugMacro(<< "almost done\n");
378  delete[] this->ChannelNames;
379  vtkDebugMacro(<< "done");
380  return 0;
381 }
382 
384 {
385  this->ClearChannelNames();
386  vtkDebugMacro(<< "allocating space for " << chNum << "channel names");
387  this->ChannelNames = new char *[chNum];
388  if ( !this->ChannelNames )
389  {
390  vtkErrorMacro(<< "Could not allocate memory for channel name table!");
391  return 1;
392  }
393  for ( int i = 0; i < chNum; i++ )
394  {
395  this->ChannelNames[i] = NULL;
396  }
397  return 0;
398 }
399 
400 int vtkLSMReader::SetChannelName(const char *chName, int chNum)
401 {
402  char *name;
403 
404  if ( !chName || chNum > this->GetNumberOfChannels() )
405  {
406  return 0;
407  }
408  if ( !this->ChannelNames )
409  {
410  this->AllocateChannelNames( this->GetNumberOfChannels() );
411  }
412 
413  size_t length = strlen(chName);
414  vtkDebugMacro(<< "length=" << length);
415  name = new char[length + 1];
416  if ( !name )
417  {
418  vtkErrorMacro(<< "Could not allocate memory for channel name");
419  return 1;
420  }
421  strncpy(name, chName, length);
422  name[length] = 0;
423  this->ChannelNames[chNum] = name;
424  return 0;
425 }
426 
427 int vtkLSMReader::FindChannelNameStart(const char *nameBuff, int length)
428 {
429  int i;
430  char ch;
431 
432  for ( i = 0; i < length; i++ )
433  {
434  ch = *( nameBuff + i );
435  if ( ch > 32 )
436  {
437  break;
438  }
439  }
440  if ( i >= length )
441  {
442  vtkWarningMacro(<< "Start of the channel name may not be found!");
443  }
444  return i;
445 }
446 
447 int vtkLSMReader::ReadChannelName(const char *nameBuff, int length, char *buffer)
448 {
449  int i;
450  char component;
451 
452  for ( i = 0; i < length; i++ )
453  {
454  component = *( nameBuff + i );
455  *( buffer + i ) = component;
456  if ( component == 0 )
457  {
458  break;
459  }
460  }
461  return i;
462 }
463 
464 int vtkLSMReader::ReadChannelDataTypes(ifstream *f, unsigned long start)
465 {
466  unsigned long pos;
467  unsigned int dataType;
468 
469  pos = start;
470  unsigned int numOfChls = this->GetNumberOfChannels();
471  this->ChannelDataTypes = vtkUnsignedIntArray::New();
472  this->ChannelDataTypes->SetNumberOfTuples(numOfChls);
473  this->ChannelDataTypes->SetNumberOfComponents(1);
474  for ( unsigned int i = 0; i < numOfChls; i++ )
475  {
476  dataType = this->ReadUnsignedInt(f, pos);
477  this->ChannelDataTypes->SetValue(i, dataType);
478  vtkDebugMacro(<< "Channel " << i << " has datatype " << dataType << "\n");
479  }
480  return 0;
481 }
482 
483 int vtkLSMReader::ReadChannelColorsAndNames(ifstream *f, unsigned long start)
484 {
485  int colNum, nameNum, sizeOfStructure, sizeOfNames, nameLength, nameSkip;
486  unsigned long colorOffset, nameOffset, pos;
487  char * nameBuff, *colorBuff, *name, *tempBuff;
488  unsigned char component;
489 
490  colorBuff = new char[5];
491 
492  pos = start;
493  // Read size of structure
494 
495  sizeOfStructure = this->ReadInt(f, pos);
496  //vtkDebugMacro(<<"size of structure = "<<sizeOfStructure<<"\n");
497  // Read number of colors
498  colNum = this->ReadInt(f, pos);
499  // Read number of names
500  nameNum = this->ReadInt(f, pos);
501  //vtkDebugMacro(<<"nameNum="<<nameNum);
502  sizeOfNames = sizeOfStructure - ( ( 10 * 4 ) + ( colNum * 4 ) );
503  //vtkDebugMacro(<<"sizeofNames="<<sizeOfNames<<"\n");
504  nameBuff = new char[sizeOfNames + 1];
505  name = new char[sizeOfNames + 1];
506 
507  if ( colNum != this->GetNumberOfChannels() )
508  {
509  vtkDebugMacro(<< "Number of channel colors is not same as number of channels!");
510  vtkDebugMacro(<< "numColors=" << colNum << ", numChls=" << this->GetNumberOfChannels() << ", numNames=" << nameNum);
511  }
512  if ( nameNum != this->GetNumberOfChannels() )
513  {
514  vtkDebugMacro(<< "Number of channel names is not same as number of channels!");
515  vtkDebugMacro(<< "numColors=" << colNum << ", numChls=" << this->GetNumberOfChannels() << ", numNames=" << nameNum);
516  }
517 
518  // Read offset to color info
519  colorOffset = this->ReadInt(f, pos) + start;
520  // Read offset to name info
521  nameOffset = this->ReadInt(f, pos) + start;
522 
523  vtkDebugMacro(<< "colorOffset=" << colorOffset);
524  vtkDebugMacro(<< "nameOffset=" << nameOffset);
525  vtkDebugMacro(<< "number of colors" << colNum);
526  this->ChannelColors->Reset();
527  this->ChannelColors->SetNumberOfValues( 3 * ( colNum + 1 ) );
528  this->ChannelColors->SetNumberOfComponents(3);
529 
530  // Read the colors
531  for ( int j = 0; j < this->GetNumberOfChannels(); j++ )
532  {
533  this->ReadFile(f, colorOffset, 4, colorBuff, 1);
534 
535  for ( int i = 0; i < 3; i++ )
536  {
537  component = this->CharPointerToUnsignedChar(colorBuff + i);
538 
539  this->ChannelColors->SetValue(i + ( 3 * j ), component);
540  }
541  }
542 
543  this->ReadFile(f, nameOffset, sizeOfNames, nameBuff, 1);
544 
545  nameLength = nameSkip = 0;
546  tempBuff = nameBuff;
547  for ( int i = 0; i < this->GetNumberOfChannels(); i++ )
548  {
549  nameSkip = this->FindChannelNameStart(tempBuff, sizeOfNames - nameSkip);
550  nameLength = this->ReadChannelName(tempBuff + nameSkip, sizeOfNames - nameSkip, name);
551 
552  tempBuff += nameSkip + nameLength;
553  vtkDebugMacro(<< "Setting channel " << i << "name");
554  this->SetChannelName(name, i);
555  }
556 
557  delete[] nameBuff;
558  delete[] name;
559  delete[] colorBuff;
560  return 0;
561 }
562 
563 int vtkLSMReader::ReadTimeStampInformation(ifstream *f, unsigned long offset)
564 {
565  int numOffStamps = 0;
566 
567  if ( offset == 0 ) // position is 0 for non-timeseries files!
568  {
569  vtkDebugMacro(<< "No timestamp information available");
570  return 0;
571  }
572  offset += 4;
573  numOffStamps = this->ReadInt(f, offset);
574  vtkDebugMacro(<< "There are " << numOffStamps << " stamps available");
575  if ( numOffStamps != this->GetNumberOfTimePoints() )
576  {
577 // vtkWarningMacro(<<"Number of time stamps does not correspond to the number
578 // off time points!");
579  }
580  this->TimeStampInformation->Reset();
581  this->TimeStampInformation->SetNumberOfTuples(numOffStamps);
582  this->TimeStampInformation->SetNumberOfComponents(1);
583  for ( int i = 0; i < numOffStamps; i++ )
584  {
585  this->TimeStampInformation->SetValue( i, this->ReadDouble(f, offset) );
586  }
587  return 0;
588 }
589 
590 /* Read the TIF_CZ_LSMINFO entry described in Table 17 of the LSM file format specification
591  *
592  *
593  */
594 int vtkLSMReader::ReadLSMSpecificInfo(ifstream *f, unsigned long pos)
595 {
596  unsigned long offset;
597 
598  vtkDebugMacro("ReadLSMSpecificInfo(stream," << pos << ")\n");
599  pos += 2 * 4; // skip over the start of the LSMInfo
600  // first 4 byte entry if magic number
601  // second is number of bytes in this structure
602 
603  // Then we read X
604  this->NumberOfIntensityValues[0] = this->ReadInt(f, pos);
605 
606  // vtkByteSwap::Swap4LE((int*)&this->NumberOfIntensityValues[0]);
607  this->Dimensions[0] = this->NumberOfIntensityValues[0];
608  // Y
609  this->NumberOfIntensityValues[1] = this->ReadInt(f, pos);
610  this->Dimensions[1] = this->NumberOfIntensityValues[1];
611  // and Z dimension
612  this->NumberOfIntensityValues[2] = this->ReadInt(f, pos);
613  this->Dimensions[2] = this->NumberOfIntensityValues[2];
614  vtkDebugMacro(<< "Dimensions =" << Dimensions[0] << "," << Dimensions[1] << "," << Dimensions[2] << "\n");
615  // Read number of channels
616  this->Dimensions[4] = this->ReadInt(f, pos);
617  vtkDebugMacro(<< "Number of Channels" << this->Dimensions[4] << "\n");
618 
619  // Read number of timepoints
620  this->NumberOfIntensityValues[3] = this->ReadInt(f, pos);
621  this->Dimensions[3] = this->NumberOfIntensityValues[3];
622 
623  // Read datatype, 1 for 8-bit unsigned int
624  // 2 for 12-bit unsigned int
625  // 5 for 32-bit float (timeseries mean of ROIs)
626  // 0 if the channels have different types
627  // In that case, u32OffsetChannelDataTypes
628  // has further info
629  this->DataType = this->ReadInt(f, pos);
630  vtkDebugMacro(<< "Data type=" << this->DataType << "\n");
631 
632  // Skip the width and height of thumbnails
633  pos += 2 * 4;
634 
635  // Read voxel sizes
636  this->VoxelSizes[0] = this->ReadDouble(f, pos);
637  this->VoxelSizes[1] = this->ReadDouble(f, pos);
638  this->VoxelSizes[2] = this->ReadDouble(f, pos);
639  vtkDebugMacro("Voxel size=" << VoxelSizes[0] << "," << VoxelSizes[1] << "," << VoxelSizes[2] << "\n");
640 
641  // Skip over OriginX,OriginY,OriginZ which are not used
642  pos += 3 * 8;
643 
644  // Read scan type which is
645  // 0 for normal x-y-z scan
646  // 1 for z-scan (x-z plane)
647  // 2 for line scan
648  // 3 for time series x-y
649  // 4 for time series x-z
650  // 5 time series mean of ROIs
651  // 6 time series x y z
652  // 7 spline scan
653  // 8 spline plane x-z
654  // 9 time series spline plane
655  // 10 point mode
656  this->ScanType = this->ReadShort(f, pos);
657  vtkDebugMacro("ScanType" << this->ScanType << "\n");
658 
659  // skip over SpectralScan flag
660  // if 0, no spectral scan
661  // if 1, image has been acquired with spectral scan mode with a "meta"
662  // detector
663  // skip over DataType, Offset to vector overlay, Offset to input LUT
664  pos += 1 * 2 + 4 * 4; // + 1*8 + 3*4;
665 
666  // Read OffsetChannelColors, which is an offset to channel colors and names
667  this->ChannelInfoOffset = this->ReadUnsignedInt(f, pos);
668  vtkDebugMacro(<< "Channel info offset (from addr" << pos << ")=" << this->ChannelInfoOffset << "\n");
670 
671  // Skip time interval in seconds (8 bytes)
672  //pos += 1*8;
673  this->TimeInterval = this->ReadDouble(f, pos);
674  printf("Time interval = %f\n", this->TimeInterval);
675 
676  // If each channel has different datatype (meaning DataType == 0), then
677  // read the offset to more information and read the info
678  this->ChannelDataTypesOffset = this->ReadInt(f, pos);
679  unsigned long scanInformationOffset = this->ReadUnsignedInt(f, pos);
680  if ( this->DataType == 0 )
681  {
683  }
684 
685  // Read scan information
686  printf("Scan information offset = %ld\n", scanInformationOffset);
687  this->ReadScanInformation(f, scanInformationOffset);
688  // SKip Zeiss Vision KS-3D speific data
689  pos += 4;
690  // Read timestamp information
691  offset = this->ReadUnsignedInt(f, pos);
692  this->ReadTimeStampInformation(f, offset);
693 
694  return 1;
695 }
696 
697 int vtkLSMReader::ReadScanInformation(ifstream *f, unsigned long pos)
698 {
699  unsigned int entry, type, size;
700  unsigned int subblocksOpen = 0;
701  char * name;
702  double wavelength = 0.;
703  char * chName;
704  int chIsOn = 0, trackIsOn = 0, isOn = 0;
705 
706  while ( 1 )
707  {
708  entry = this->ReadUnsignedInt(f, pos);
709  type = this->ReadUnsignedInt(f, pos);
710  size = this->ReadUnsignedInt(f, pos);
711 
712  //printf("entry=%d\n", entry);
713  if ( type == TYPE_SUBBLOCK && entry == SUBBLOCK_END ) { subblocksOpen--; }
714  else if ( type == TYPE_SUBBLOCK )
715  {
716  subblocksOpen++;
717  }
718 
719  switch ( entry )
720  {
722  this->ReadDouble(f, pos); // double gain
723  continue;
724  break;
726  this->ReadDouble(f, pos); // double gain
727  continue;
728  break;
730  this->ReadInt(f, pos); // int mode
731  continue;
732  break;
733  case LASER_ENTRY_NAME:
734  name = new char[size + 1];
735  this->ReadData(f, pos, size, name);
736  //printf("Laser name: %s\n", name);
737  this->LaserNames->InsertNextValue(name);
738  delete[] name;
739  continue;
740  break;
742  wavelength = this->ReadDouble(f, pos);
743  continue;
744  break;
746  chName = new char[size + 1];
747  this->ReadData(f, pos, size, chName);
748 // printf("chName = %s\n", chName);
749  delete[] chName;
750  continue;
751  break;
752  case TRACK_ENTRY_ACQUIRE:
753  trackIsOn = this->ReadInt(f, pos);
754  continue;
755  break;
756  case TRACK_ENTRY_NAME:
757  chName = new char[size + 1];
758  this->ReadData(f, pos, size, chName);
759  if ( trackIsOn )
760  {
761  // printf("Track name = %s is on\n", chName);
762  }
763  delete[] chName;
764  continue;
765  break;
767  chName = new char[size + 1];
768  this->ReadData(f, pos, size, chName);
769  if ( chIsOn )
770  {
771  //printf("Detection channel name = %s is on\n", chName);
772  }
773  delete[] chName;
774  continue;
775  break;
777  chIsOn = this->ReadInt(f, pos);
778  continue;
779  break;
781  isOn = this->ReadInt(f, pos);
782  if ( isOn )
783  {
784  if ( trackIsOn )
785  {
786  this->TrackWavelengths->InsertNextValue(wavelength);
787  //printf("Acquired using wavelength: %f\n", wavelength);
788  }
789  }
790  continue;
791  break;
793  Description = new char[size + 1];
794  this->ReadData(f, pos, size, Description);
795 // printf("Description: %s\n", Description);
796  continue;
797  break;
799  Objective = new char[size + 1];
800  this->ReadData(f, pos, size, Objective);
801  continue;
802 
803  case SUBBLOCK_RECORDING:
804  break;
805  case SUBBLOCK_LASERS:
806  break;
807  case SUBBLOCK_LASER:
808  break;
809  case SUBBLOCK_TRACKS:
810  break;
811  case SUBBLOCK_TRACK:
812  break;
814  break;
816  break;
818  break;
820  break;
822  break;
824  break;
826  break;
828  break;
829  case SUBBLOCK_TIMERS:
830  break;
831  case SUBBLOCK_TIMER:
832  break;
833  case SUBBLOCK_MARKERS:
834  break;
835  case SUBBLOCK_MARKER:
836  break;
837  }
838  if ( subblocksOpen == 0 ) { break; }
839  // By default, skip the entry
840  pos += size;
841  }
842  return 0;
843 }
844 
845 int vtkLSMReader::AnalyzeTag(ifstream *f, unsigned long startPos)
846 {
847  char tempValue[4], tempValue2[4];
848  char *actualValue = NULL;
849 
850  //vtkDebugMacro(<<"Analyze tag start pos="<<startPos<<"\n");
851  unsigned short tag = this->ReadUnsignedShort(f, startPos);
852  unsigned short type = this->ReadUnsignedShort(f, startPos);
853  unsigned int length = this->ReadUnsignedInt(f, startPos);
854 
855  this->ReadFile(f, startPos, 4, tempValue);
856 
857  unsigned int i;
858 
859  for ( i = 0; i < 4; i++ )
860  {
861  tempValue2[i] = tempValue[i];
862  }
863 
864 #ifdef VTK_WORDS_BIGENDIAN
865  vtkByteSwap::Swap4LE( (unsigned int *)tempValue2 );
866 #endif
867  unsigned int value = this->CharPointerToUnsignedInt(tempValue2);
868 
869  // if there is more than 4 bytes in value,
870  // value is an offset to the actual data
871  int dataSize = this->TIFF_BYTES(type);
872  unsigned int readSize = dataSize * length;
873  if ( readSize > 4 && tag != TIF_CZ_LSMINFO )
874  {
875  actualValue = new char[readSize];
876  startPos = value;
877  if ( tag == TIF_STRIPOFFSETS || tag == TIF_STRIPBYTECOUNTS )
878  {
879  // vtkDebugMacro(<<"Reading actual value from "<<startPos<<"to " <<
880  // startPos+readSize);
881  if ( this->ReadFile(f, startPos, readSize, actualValue) == 0 )
882  {
883  vtkErrorMacro(<< "Failed to get strip offsets\n");
884  return 0;
885  }
886  }
887  }
888  else
889  {
890  actualValue = new char[4];
891  for ( int o = 0; o < 4; o++ )
892  {
893  actualValue[o] = tempValue[o];
894  }
895  }
896  switch ( tag )
897  {
898  case TIF_NEWSUBFILETYPE:
899 // vtkDebugMacro(<<"New subfile type="<<value);
900  this->NewSubFileType = value;
901  break;
902 
903  case TIF_IMAGEWIDTH:
904 #ifdef VTK_WORDS_BIGENDIAN
905  vtkByteSwap::Swap4LE( (unsigned int *)actualValue );
906  vtkDebugMacro(<< "Image width=" << value);
907 #endif
908  //this->Dimensions[0] = this->CharPointerToUnsignedInt(actualValue);
909  //this->Dimensions[0] = value;
910  break;
911 
912  case TIF_IMAGELENGTH:
913 #ifdef VTK_WORDS_BIGENDIAN
914  vtkByteSwap::Swap4LE( (unsigned int *)actualValue );
915  //this->Dimensions[1] = this->CharPointerToUnsignedInt(actualValue);
916  vtkDebugMacro(<< "Image length=" << value);
917 #endif
918  //this->Dimensions[1] = value;
919  break;
920 
921  case TIF_BITSPERSAMPLE:
922 #ifdef VTK_WORDS_BIGENDIAN
923  vtkByteSwap::Swap2LE( (unsigned short *)actualValue );
924 #endif
925  this->BitsPerSample->SetNumberOfValues(length);
926  unsigned short bitsPerSample;
927  for ( i = 0; i < length; i++ )
928  {
929  bitsPerSample = this->CharPointerToUnsignedShort( actualValue + ( this->TIFF_BYTES(TIFF_SHORT) * i ) );
930  this->BitsPerSample->SetValue(i, bitsPerSample);
931  }
932  break;
933 
934  case TIF_COMPRESSION:
935 #ifdef VTK_WORDS_BIGENDIAN
936  vtkByteSwap::Swap2LE( (unsigned short *)actualValue );
937 #endif
938  this->Compression = this->CharPointerToUnsignedShort(actualValue);
939  break;
940 
942 #ifdef VTK_WORDS_BIGENDIAN
943  vtkByteSwap::Swap2LE( (unsigned short *)actualValue );
944 #endif
945  this->PhotometricInterpretation = this->CharPointerToUnsignedShort(actualValue);
946  break;
947 
948  case TIF_STRIPOFFSETS:
949  // vtkDebugMacro(<<"Number of values="<<length);
950  this->StripOffset->SetNumberOfValues(length);
951 #ifdef VTK_WORDS_BIGENDIAN
952  vtkByteSwap::Swap4LERange( (unsigned int *)actualValue, length );
953 #endif
954  if ( length > 1 )
955  {
956  unsigned int *offsets =
957  static_cast< unsigned int * >( static_cast< void * >( actualValue ) );
958 
959  for ( i = 0; i < length; i++ )
960  {
962  unsigned int stripOffset = offsets[i];
963  // vtkDebugMacro(<<"Strip offset to "<<i<<"="<<stripOffset);
964  this->StripOffset->SetValue(i, stripOffset);
965  }
966  }
967  else
968  {
969  // vtkDebugMacro(<<"Strip offset to only channel="<<value);
970  this->StripOffset->SetValue(0, value);
971  }
972  break;
973 
974  case TIF_SAMPLESPERPIXEL:
975 #ifdef VTK_WORDS_BIGENDIAN
976  vtkByteSwap::Swap4LE( (unsigned int *)actualValue );
977 #endif
978  this->SamplesPerPixel = this->CharPointerToUnsignedInt(actualValue);
979  // vtkDebugMacro(<<"Samples per pixel="<<SamplesPerPixel<<"\n");
980  break;
981 
982  case TIF_STRIPBYTECOUNTS:
983 #ifdef VTK_WORDS_BIGENDIAN
984  vtkByteSwap::Swap4LERange( (unsigned int *)actualValue, length );
985 #endif
986  this->StripByteCount->SetNumberOfValues(length);
987 
988  if ( length > 1 )
989  {
990  for ( i = 0; i < length; i++ )
991  {
992  // unsigned int* counts = (unsigned int*)actualValue;
993  unsigned int bytecount = this->CharPointerToUnsignedInt( actualValue + ( this->TIFF_BYTES(TIFF_LONG) * i ) );
994 
995  this->StripByteCount->SetValue(i, bytecount);
996  // vtkDebugMacro(<<"Strip byte count of " << i <<"="<<counts[i]
997  // <<"("<<bytecount<<")");
998  }
999  }
1000  else
1001  {
1002  //vtkDebugMacro(<<"Bytecount of only strip="<<value);
1003  this->StripByteCount->SetValue(0, value);
1004  }
1005  break;
1007 #ifdef VTK_WORDS_BIGENDIAN
1008  vtkByteSwap::Swap2LE( (unsigned short *)actualValue );
1009 #endif
1010  this->PlanarConfiguration = this->CharPointerToUnsignedShort(actualValue);
1011  break;
1012  case TIF_PREDICTOR:
1013 #ifdef VTK_WORDS_BIGENDIAN
1014  vtkByteSwap::Swap2LE( (unsigned short *)actualValue );
1015 #endif
1016  this->Predictor = this->CharPointerToUnsignedShort(actualValue);
1017  break;
1018  case TIF_COLORMAP:
1019 #ifdef VTK_WORDS_BIGENDIAN
1020  vtkByteSwap::Swap4LE( (unsigned int *)actualValue );
1021 #endif
1022  //this->ColorMapOffset = this->CharPointerToUnsignedInt(actualValue);
1023  break;
1024  case TIF_CZ_LSMINFO:
1025 
1026  this->LSMSpecificInfoOffset = value;
1027  break;
1028  }
1029 
1030  if ( actualValue )
1031  {
1032  delete[] actualValue;
1033  }
1034  return 0;
1035 }
1036 
1037 /*------------------------------------------------------------------------------------------*/
1038 
1040 {
1041  return this->Identifier;
1042 }
1043 
1045 {
1046  return ( this->GetHeaderIdentifier() == LSM_MAGIC_NUMBER );
1047 }
1048 
1050 {
1051  return ( this->Compression == LSM_COMPRESSED );
1052 }
1053 
1055 {
1056  return this->Dimensions[3];
1057 }
1058 
1060 {
1061  return this->Dimensions[4];
1062 }
1063 
1064 unsigned long vtkLSMReader::GetStripByteCount(unsigned int timepoint, unsigned int slice)
1065 {
1066  if ( !this->ReadSizes )
1067  {
1068  vtkErrorMacro(<< "Tried to get read size but table not constructed\n");
1069  }
1070  return this->ReadSizes->GetValue(timepoint * this->Dimensions[2] + slice);
1071 }
1072 
1073 unsigned long vtkLSMReader::GetSliceOffset(unsigned int timepoint, unsigned int slice)
1074 {
1075  if ( !this->ImageOffsets )
1076  {
1077  vtkErrorMacro(<< "Request slice offset but table not constructed\n");
1078  return 0;
1079  }
1080  return this->ImageOffsets->GetValue(timepoint * this->Dimensions[2] + slice);
1081 }
1082 
1084 {
1085 // unsigned long int startPos = 2;
1086  if ( !this->ImageOffsets )
1087  {
1088  this->ImageOffsets = vtkUnsignedLongArray::New();
1089  this->ReadSizes = vtkUnsignedLongArray::New();
1090  int length = this->Dimensions[2] * this->Dimensions[3];
1091  this->ImageOffsets->SetNumberOfTuples(length);
1092  this->ReadSizes->SetNumberOfTuples(length);
1093  for ( int j = 0; j < length; j++ )
1094  {
1095  this->ImageOffsets->SetValue(j, 0);
1096  this->ReadSizes->SetValue(j, 0);
1097  }
1098  }
1099  int channel = this->GetUpdateChannel();
1100  unsigned long temp, offset, readSize;
1101 
1102  for ( int tp = 0; tp < this->Dimensions[3]; tp++ )
1103  {
1104  for ( int slice = 0; slice < this->Dimensions[2]; slice++ )
1105  {
1106  temp = tp * this->Dimensions[2] + slice;
1107  this->GetOffsetToImage(slice, tp);
1108  offset = this->StripOffset->GetValue(channel);
1109  readSize = this->StripByteCount->GetValue(channel);
1110  this->ImageOffsets->SetValue(temp, offset);
1111  this->ReadSizes->SetValue(temp, readSize);
1112  }
1113  }
1114 }
1115 
1116 unsigned long vtkLSMReader::GetOffsetToImage(int slice, int timepoint)
1117 {
1118  unsigned long temp = slice + ( timepoint * this->Dimensions[2] );
1119 
1120  return this->SeekFile(temp);
1121 }
1122 
1123 unsigned long vtkLSMReader::SeekFile(unsigned long image)
1124 {
1125  unsigned long offset = 4, finalOffset;
1126  // int readSize = 4;
1127  unsigned long i = 0;
1128  //unsigned short numberOfTags = 0;
1129  unsigned long imageCount = image + 1;
1130 
1131  if ( this->OffsetToLastAccessedImage && ( this->NumberOfLastAccessedImage < image ) )
1132  {
1133  offset = this->OffsetToLastAccessedImage;
1134  imageCount = image - this->NumberOfLastAccessedImage;
1135 // vtkDebugMacro(<<"offset of last image:
1136 // "<<offset<<"imageCount="<<imageCount<<"\n");
1137  }
1138  else
1139  {
1140  offset = (unsigned long)this->ReadInt(this->GetFile(), offset);
1141  vtkDebugMacro(<< "offset (from file): " << offset << "\n");
1142  }
1143 
1144  offset = this->ReadImageDirectory(this->GetFile(), offset);
1145 // vtkDebugMacro(<<"Offset: "<<offset<<", imageCount: "<<imageCount<<"\n");
1146  do
1147  {
1148  // we count only image directories and not thumbnail images
1149  // subfiletype 0 = images
1150  // subfiletype 1 = thumbnails
1151  //vtkDebugMacro(<<"SubFileType="<<this->NewSubFileType<<"\n");
1152  if ( this->NewSubFileType == 0 )
1153  {
1154  i++;
1155  }
1156  finalOffset = offset;
1157  offset = this->ReadImageDirectory(this->GetFile(), offset);
1158  //vtkDebugMacro(<<"i="<<i<<", imageCount="<<imageCount<<",
1159  // offset="<<offset<<"\n");
1160  }
1161  while ( i < imageCount && offset != 0 );
1162 
1163  this->OffsetToLastAccessedImage = finalOffset;
1164  this->NumberOfLastAccessedImage = image;
1165 
1166  return finalOffset;
1167 }
1168 
1169 unsigned long vtkLSMReader::ReadImageDirectory(ifstream *f, unsigned long offset)
1170 {
1171  unsigned short numberOfTags = 0;
1172  unsigned long nextOffset = offset;
1173 
1174  //vtkDebugMacro(<<"Reading unsigned short from "<<offset<<"\n");
1175  numberOfTags = this->ReadUnsignedShort(f, offset);
1176  for ( int i = 0; i < numberOfTags; i++ )
1177  {
1178  this->AnalyzeTag(f, offset);
1179  //vtkDebugMacro(<<"Tag analyed...\n");
1180  if ( this->NewSubFileType == 1 )
1181  {
1182  //vtkDebugMacro(<<"Found thumbnail, get next");
1183  break; //thumbnail image
1184  }
1185  offset = offset + 12;
1186  //vtkDebugMacro(<<"New offset="<<offset);
1187  }
1188  nextOffset += 2 + numberOfTags * 12;
1189  return this->ReadUnsignedInt(f, nextOffset);
1190 }
1191 
1192 void vtkLSMReader::DecodeHorizontalDifferencing(unsigned char *buffer, int size)
1193 {
1194 // std::cout <<"DecodeHorizontalDifferencing " <<size <<std::endl;
1195 // assert( size < 255 );
1196  for ( int i = 1; i < size; i++ )
1197  {
1198  *( buffer + i ) = *( buffer + i ) + *( buffer + i - 1 );
1199  }
1200 }
1201 
1202 void vtkLSMReader::DecodeHorizontalDifferencingUnsignedShort(unsigned short *buffer, int size)
1203 {
1204 // assert( size < 32767 );
1205 // std::cout <<"DecodeHorizontalDifferencingUnsignedShort " <<size
1206 // <<std::endl;
1207 
1208  for ( int i = 1; i < size; i++ )
1209  {
1210  *( buffer + i ) = *( buffer + i ) + *( buffer + i - 1 );
1211  }
1212 }
1213 
1214 void vtkLSMReader::DecodeLZWCompression(unsigned char *buffer, int size)
1215 {
1216  (void)buffer;
1217  (void)size;
1218 
1219  vtkErrorMacro(
1220  << "vtkLSMReader does not handle LZW Compression anymore for license issue");
1221 /*
1222  LZWState *s = new LZWState;
1223 
1224  unsigned char *outbuf = new unsigned char[size];
1225 
1226  unsigned char *outbufp = outbuf;
1227  unsigned char *bufp = buffer;
1228 
1229  int width = this->Dimensions[0];
1230  int channel = this->GetUpdateChannel();
1231  int bytes = this->BYTES_BY_DATA_TYPE(this->GetDataTypeForChannel(channel));
1232  int lines = size / (width*bytes);
1233  lzw_decode_init(s, 8, bufp, size);
1234  vtkDebugMacro(<<"Size: "<<size<<", bytes per pixel: "<<bytes<<", lines: "<<lines<<", width: "<<width<<"\n");
1235 
1236  //int decoded =
1237  lzw_decode(s, outbufp, size);
1238  outbufp = outbuf;
1239  for(int line = 0; line < lines; line++)
1240  {
1241  if(this->Predictor == 2)
1242  {
1243  if(bytes == 1)
1244  {
1245  this->DecodeHorizontalDifferencing(outbufp,width*bytes);
1246  }
1247  else
1248  {
1249  this->DecodeHorizontalDifferencingUnsignedShort(
1250  static_cast<unsigned short*>(static_cast<void*>(outbufp)),
1251  width );
1252  }
1253  }
1254  outbufp += width*bytes;
1255  }
1256 
1257  for(int i=0;i < size;i++)
1258  {
1259  buffer[i] = outbuf[i];
1260  }
1261  vtkDebugMacro(<<"Decoding done"<<"\n");
1262  delete s;
1263  delete []outbuf;
1264 */
1265 }
1266 
1267 int vtkLSMReader::GetDataTypeForChannel(unsigned int channel)
1268 {
1269  if ( this->DataType != 0 )
1270  {
1271  return this->DataType;
1272  }
1273  if ( !this->ChannelDataTypes ) { return 1; }
1274  return this->ChannelDataTypes->GetValue(channel);
1275 }
1276 
1277 //----------------------------------------------------------------------------
1278 // Convert to Imaging API
1280  vtkInformation *vtkNotUsed(request),
1281  vtkInformationVector **vtkNotUsed(inputVector),
1282  vtkInformationVector *outputVector)
1283 {
1284  unsigned long offset; //, imageOffset;;
1285  int outExtent[6];
1286 
1287  if ( !this->ImageOffsets )
1288  {
1289  vtkDebugMacro(<< "Constructing slice offset table\n");
1290  this->ConstructSliceOffsets();
1291  }
1292 
1293  // get the info object
1294  vtkInformation *outInfo = outputVector->GetInformationObject(0);
1295  vtkImageData * data = this->AllocateOutputData( outInfo->Get( vtkDataObject::DATA_OBJECT() ) );
1296  data->GetPointData()->GetScalars()->SetName("LSM Scalars");
1297  data->GetExtent(outExtent);
1298 
1299  if ( !this->Identifier )
1300  {
1301  vtkDebugMacro(<< "Can not execute data since information has not been executed!");
1302  return 0;
1303  }
1304  vtkDebugMacro(
1305  << "Update extent: " << outExtent[0] << ", " << outExtent[1] << ", " << outExtent[2] << ", " << outExtent[3]
1306  << ", " << outExtent[4] << "," << outExtent[5] << "\n");
1307  // if given time point or channel index is bigger than maximum,
1308  // we use maximum
1309  int timepoint = ( this->IntUpdateExtent[3] > ( this->GetNumberOfTimePoints() - 1 ) ?
1310  this->GetNumberOfTimePoints() - 1 : this->IntUpdateExtent[3] );
1311 
1312  int channel = this->GetUpdateChannel();
1313 // int nSlices = (outExtent[5]-outExtent[4])+1;
1314 // std::cout <<"Timepoint="<<timepoint<<", channel="<<channel<<", "<<nSlices<<"
1315 // slices"<< std::endl;
1316  unsigned int numberOfPixels = this->Dimensions[0] * this->Dimensions[1] * ( outExtent[5] - outExtent[4] + 1 );
1317  int dataType = this->GetDataTypeForChannel(channel);
1318  unsigned int size = numberOfPixels * this->BYTES_BY_DATA_TYPE(dataType);
1319  vtkDebugMacro(
1320  << "numberOfPixels=" << numberOfPixels << ", buffer size=" << size << ", datatype=" << dataType
1321  << ", bytes by datatype=" << this->BYTES_BY_DATA_TYPE(dataType) << "\n");
1322 
1323  // this buffer will be deleted by the vtkXXXArray when the array is destroyed.
1324 
1325  unsigned char *buf = new unsigned char[size];
1326  unsigned char *tempBuf = buf;
1327  unsigned int readSize;
1328 
1329  time_t start = time (NULL);
1330  for ( int i = outExtent[4]; i <= outExtent[5]; ++i )
1331  {
1332  offset = this->GetSliceOffset(timepoint, i);
1333  readSize = static_cast< unsigned int >( this->GetStripByteCount(timepoint, i) );
1334 
1335  vtkDebugMacro(
1336  << "Offset to tp " << timepoint << ", slice " << i << " = " << offset << ", strip byte count: " << readSize
1337  << "\n");
1338 
1339  for ( unsigned long ii = 0; ii < readSize; ii++ )
1340  {
1341  tempBuf[ii] = 0;
1342  }
1343 
1344  std::streamsize bytes = this->ReadFile(this->GetFile(), offset, readSize,
1345  static_cast< char * >( static_cast< void * >( tempBuf ) ), 1);
1346 
1347  if ( static_cast< unsigned int >( bytes ) != readSize )
1348  {
1349  vtkDebugMacro(<< "Asked for " << readSize << " bytes, got " << bytes << "\n");
1350  vtkDebugMacro(<< "File status: fail: " << this->GetFile()->fail() << ", eof: " << this->GetFile()->eof() << "\n");
1351  this->GetFile()->clear();
1352  }
1353  if ( this->IsCompressed() )
1354  {
1355  this->DecodeLZWCompression(tempBuf, readSize);
1356  }
1357  tempBuf += readSize;
1358  }
1359  time_t end = time (NULL);
1360 
1361  (void) start;
1362  (void) end;
1363 
1364  vtkDebugMacro(<< "Dataset generation time: " << end - start);
1365 
1366  vtkUnsignedCharArray * uscarray;
1367  vtkUnsignedShortArray *ussarray;
1368  if ( this->BYTES_BY_DATA_TYPE(dataType) > 1 )
1369  {
1370  ussarray = vtkUnsignedShortArray::New();
1371  ussarray->SetNumberOfComponents(1);
1372  ussarray->SetNumberOfValues(numberOfPixels);
1373 
1374  ussarray->SetArray(static_cast< unsigned short * >( static_cast< void * >( buf ) ),
1375  numberOfPixels, 0);
1376  data->GetPointData()->SetScalars(ussarray);
1377 
1378  ussarray->Delete();
1379  }
1380  else
1381  {
1382  uscarray = vtkUnsignedCharArray::New();
1383  uscarray->SetNumberOfComponents(1);
1384  uscarray->SetNumberOfValues(numberOfPixels);
1385 
1386  uscarray->SetArray(buf, numberOfPixels, 0);
1387  data->GetPointData()->SetScalars(uscarray);
1388 
1389  uscarray->Delete();
1390  }
1391 
1392  return 1;
1393 }
1394 
1396  vtkInformation *request,
1397  vtkInformationVector **inputVector,
1398  vtkInformationVector *outputVector)
1399 {
1400  (void)request;
1401  (void)inputVector;
1402 
1403  int uext[6], ext[6];
1404 
1405  vtkInformation *outInfo = outputVector->GetInformationObject(0);
1406  //vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
1407 
1408  outInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), ext);
1409  // Get the requested update extent from the output.
1410  outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), uext);
1411 
1412  // If they request an update extent that doesn't cover the whole slice
1413  // then modify the uextent
1414  if ( uext[1] < ext[1] ) { uext[1] = ext[1]; }
1415  if ( uext[3] < ext[3] ) { uext[3] = ext[3]; }
1416  outInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), uext, 6);
1417  //request->Set(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT(),
1418  // uext,6);
1419  return 1;
1420 }
1421 
1423  vtkInformation *vtkNotUsed(request),
1424  vtkInformationVector **vtkNotUsed(inputVector),
1425  vtkInformationVector *outputVector)
1426 {
1427  unsigned long startPos;
1428  unsigned int imageDirOffset;
1429  int dataType;
1430 
1431 // char buf[12];
1432 
1433  vtkInformation *outInfo = outputVector->GetInformationObject(0);
1434 
1436 
1437  if ( !this->NeedToReadHeaderInformation() )
1438  {
1439  vtkDebugMacro(<< "Don't need to read header information");
1440  return 1;
1441  }
1442 
1443  vtkDebugMacro(<< "Executing information.");
1444 
1445  if ( !this->OpenFile() )
1446  {
1447  this->Identifier = 0;
1448  return 0;
1449  }
1450 
1451  startPos = 2; // header identifier
1452 
1453  this->Identifier = this->ReadUnsignedShort(this->GetFile(), startPos);
1454  if ( !this->IsValidLSMFile() )
1455  {
1456  vtkErrorMacro("Given file is not a valid LSM-file.");
1457  return 0;
1458  }
1459 
1460  imageDirOffset = this->ReadUnsignedInt(this->GetFile(), startPos);
1461 
1462  this->ReadImageDirectory(this->GetFile(), imageDirOffset);
1463 
1464  if ( this->LSMSpecificInfoOffset )
1465  {
1466  ReadLSMSpecificInfo( this->GetFile(), static_cast< unsigned long >( this->LSMSpecificInfoOffset ) );
1467  }
1468  else
1469  {
1470  vtkErrorMacro("Did not found LSM specific info!");
1471  return 0;
1472  }
1473  if ( !( this->ScanType == 6 || this->ScanType == 0 || this->ScanType == 3 ) )
1474  {
1475  vtkErrorMacro(
1476  "Sorry! Your LSM-file must be of type 6 LSM-file (time series x-y-z) or type 0 (normal x-y-z) or type 3 (2D + time). Type of this File is "
1477  << this->ScanType);
1478  return 0;
1479  }
1480 
1481  vtkDebugMacro(<< "Executing information: first directory has been read.");
1482 
1483  this->CalculateExtentAndSpacing(this->DataExtent, this->DataSpacing);
1484  outInfo->Set(vtkDataObject::SPACING(), this->DataSpacing, 3);
1485 
1486  outInfo->Set(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(),
1487  this->DataExtent, 6);
1488 
1489  this->NumberOfScalarComponents = 1;
1490 
1491  int channel = this->GetUpdateChannel();
1492  dataType = this->GetDataTypeForChannel(channel);
1493  if ( dataType > 1 )
1494  {
1495  this->DataScalarType = VTK_UNSIGNED_SHORT;
1496  }
1497  else
1498  {
1499  this->DataScalarType = VTK_UNSIGNED_CHAR;
1500  }
1501  vtkDataObject::SetPointDataActiveScalarInfo(outInfo, this->DataScalarType,
1502  this->NumberOfScalarComponents);
1503 
1505  vtkDebugMacro(<< "Executing information: executed.");
1506  return 1;
1507 }
1508 
1509 void vtkLSMReader::CalculateExtentAndSpacing(int extent[6], double spacing[3])
1510 {
1511  extent[0] = extent[2] = extent[4] = 0;
1512  extent[1] = this->Dimensions[0] - 1;
1513  extent[3] = this->Dimensions[1] - 1;
1514  extent[5] = this->Dimensions[2] - 1;
1515 
1516  spacing[0] = this->VoxelSizes[0] * 1000000;
1517  spacing[1] = this->VoxelSizes[1] * 1000000;
1518  spacing[2] = this->VoxelSizes[2] * 1000000;
1519 }
1520 
1521 //-------------------------------------------------------------------------
1522 
1523 int vtkLSMReader::GetChannelColorComponent(int ch, int component)
1524 {
1525  if ( ch < 0 || ch > this->GetNumberOfChannels() - 1 || component < 0 || component > 2 )
1526  {
1527  return 0;
1528  }
1529  return *( this->ChannelColors->GetPointer( ( ch * 3 ) + component ) );
1530 }
1531 
1532 vtkImageData * vtkLSMReader::GetTimePointOutput(int timepoint, int channel)
1533 {
1534  this->SetUpdateTimePoint(timepoint);
1535  this->SetUpdateChannel(channel);
1536  return this->GetOutput();
1537 }
1538 
1540 {
1541  if ( timepoint < 0 || timepoint == this->IntUpdateExtent[3] )
1542  {
1543  return;
1544  }
1545  this->IntUpdateExtent[3] = timepoint;
1546  this->Modified();
1547 }
1548 
1550 {
1551  if ( ch < 0 || ch == this->IntUpdateExtent[4] )
1552  {
1553  return;
1554  }
1555  this->IntUpdateExtent[4] = ch;
1556 // std::cout << "Update channel is now " << ch << std::endl;
1557  this->Modified();
1558 }
1559 
1561 {
1562  this->FileNameChanged = 1;
1563 }
1564 
1566 {
1567  this->FileNameChanged = 0;
1568 }
1569 
1571 {
1572  return this->FileNameChanged;
1573 }
1574 
1576 {
1577  return this->File;
1578 }
1579 
1581 {
1582  int bytes = 1;
1583 
1584  switch ( type )
1585  {
1586  case ( 1 ):
1587  return 1;
1588  case ( 2 ):
1589  return 2;
1590  case ( 5 ):
1591  return 4;
1592  }
1593  return bytes;
1594 }
1595 
1596 int vtkLSMReader::TIFF_BYTES(unsigned short type)
1597 {
1598  switch ( type )
1599  {
1600  default:
1601  case ( TIFF_BYTE ):
1602  return 1;
1603  case ( TIFF_ASCII ):
1604  case ( TIFF_SHORT ):
1605  return 2;
1606  case ( TIFF_LONG ):
1607  case ( TIFF_RATIONAL ):
1608  return 4;
1609  }
1610 }
1611 
1613 {
1614  return *static_cast< unsigned char * >( static_cast< void * >( buf ) );
1615 }
1616 
1618 {
1619  return *static_cast< int * >( static_cast< void * >( buf ) );
1620 }
1621 
1623 {
1624  return *static_cast< unsigned int * >( static_cast< void * >( buf ) );
1625 }
1626 
1628 {
1629  return *static_cast< short * >( static_cast< void * >( buf ) );
1630 }
1631 
1633 {
1634  return *static_cast< unsigned short * >( static_cast< void * >( buf ) );
1635 }
1636 
1638 {
1639  return *static_cast< double * >( static_cast< void * >( buf ) );
1640 }
1641 
1642 int vtkLSMReader::ReadInt(ifstream *f, unsigned long & pos)
1643 {
1644  char buff[4];
1645 
1646  this->ReadFile(f, pos, 4, buff);
1647 #ifdef VTK_WORDS_BIGENDIAN
1648  vtkByteSwap::Swap4LE( (int *)buff );
1649 #endif
1650  return CharPointerToInt(buff);
1651 }
1652 
1653 unsigned int vtkLSMReader::ReadUnsignedInt(ifstream *f, unsigned long & pos)
1654 {
1655  char buff[4];
1656 
1657  this->ReadFile(f, pos, 4, buff);
1658 #ifdef VTK_WORDS_BIGENDIAN
1659  vtkByteSwap::Swap4LE( (unsigned int *)buff );
1660 #endif
1661  return this->CharPointerToUnsignedInt(buff);
1662 }
1663 
1664 short vtkLSMReader::ReadShort(ifstream *f, unsigned long & pos)
1665 {
1666  char buff[2];
1667 
1668  this->ReadFile(f, pos, 2, buff);
1669 #ifdef VTK_WORDS_BIGENDIAN
1670  vtkByteSwap::Swap2LE( (short *)buff );
1671 #endif
1672  return this->CharPointerToShort(buff);
1673 }
1674 
1675 unsigned short vtkLSMReader::ReadUnsignedShort(ifstream *f, unsigned long & pos)
1676 {
1677  char buff[2];
1678 
1679  this->ReadFile(f, pos, 2, buff);
1680 #ifdef VTK_WORDS_BIGENDIAN
1681  vtkByteSwap::Swap2LE( (unsigned short *)buff );
1682 #endif
1683  return this->CharPointerToUnsignedShort(buff);
1684 }
1685 
1686 double vtkLSMReader::ReadDouble(ifstream *f, unsigned long & pos)
1687 {
1688  char buff[8];
1689 
1690  this->ReadFile(f, pos, 8, buff);
1691 #ifdef VTK_WORDS_BIGENDIAN
1692  vtkByteSwap::Swap8LE( (double *)buff );
1693 #endif
1694  return this->CharPointerToDouble(buff);
1695 }
1696 
1697 std::streamsize
1698 vtkLSMReader::ReadData(ifstream *f, unsigned long & pos, unsigned int size, char *buf)
1699 {
1700  return this->ReadFile(f, pos, size, buf, 1);
1701 }
1702 
1703 std::streamsize
1704 vtkLSMReader::ReadFile(ifstream *f, unsigned long & pos, unsigned int size, char *buf, bool swap)
1705 {
1706  std::streamsize ret = 1;
1707 
1708  f->seekg(pos, ios::beg);
1709  f->read(buf, size);
1710 #ifdef VTK_WORDS_BIGENDIAN
1711  if ( swap )
1712  {
1713  vtkByteSwap::SwapLERange(buf, size);
1714  }
1715 #else
1716  (void)swap;
1717 #endif
1718  //if(f->fail() || f->eof()) ret=0;
1719  ret = f->gcount();
1720  if ( !f ) { return 0; }
1721  pos = pos + size;
1722  return ret;
1723 }
1724 
1726 {
1727  return ( this->IntUpdateExtent[4] > this->GetNumberOfChannels() - 1 ? this->GetNumberOfChannels()
1728  - 1 : this->IntUpdateExtent[4] );
1729 }
1730 
1731 void vtkLSMReader::PrintSelf(ostream & os, vtkIndent indent)
1732 {
1733  this->Superclass::PrintSelf(os, indent);
1734  os << indent << "Identifier: " << this->Identifier << "\n";
1735  os << indent << "Dimensions: " << this->Dimensions[0] << "," << this->Dimensions[1] << "," << this->Dimensions[2]
1736  << "\n";
1737  os << indent << "Time points: " << this->Dimensions[3] << "\n";
1738  os << "Number of channels: " << this->Dimensions[4] << "\n";
1739  os << "\n";
1740  os << indent << "Number of intensity values X: " << this->NumberOfIntensityValues[0] << "\n";
1741  os << indent << "Number of intensity values Y: " << this->NumberOfIntensityValues[1] << "\n";
1742  os << indent << "Number of intensity values Z: " << this->NumberOfIntensityValues[2] << "\n";
1743  os << indent << "Number of intensity values Time: " << this->NumberOfIntensityValues[3] << "\n";
1744  os << indent << "Voxel size X: " << this->VoxelSizes[0] << "\n";
1745  os << indent << "Voxel size Y: " << this->VoxelSizes[1] << "\n";
1746  os << indent << "Voxel size Z: " << this->VoxelSizes[2] << "\n";
1747  os << "\n";
1748  os << indent << "Scan type: " << this->ScanType << "\n";
1749  os << indent << "Data type: " << this->DataType << "\n";
1750  if ( this->DataType == 0 )
1751  {
1752  for ( int i = 0; i < this->GetNumberOfChannels(); i++ )
1753  {
1754  os << indent << indent << "Data type of channel " << i << ": " << this->ChannelDataTypes->GetValue(i) << "\n";
1755  }
1756  }
1757  os << indent << "Compression: " << this->Compression << "\n";
1758  os << "\n";
1759  os << indent << "Planar configuration: " << this->PlanarConfiguration << "\n";
1760  os << indent << "Photometric interpretation: " << this->PhotometricInterpretation << "\n";
1761  os << indent << "Predictor: " << this->Predictor << "\n";
1762  os << indent << "Channel info:\n";
1763 
1764  for ( int i = 0; i < this->Dimensions[4]; i++ )
1765  {
1766  os << indent << indent << this->GetChannelName(i) << ",("
1767  << this->GetChannelColorComponent(i,
1768  0) << ","
1769  << this->GetChannelColorComponent(i, 1) << "," << this->GetChannelColorComponent(i, 2) << ")\n";
1770  }
1771  os << indent << "Strip byte counts:\n";
1772 
1773  for ( int i = 0; i < this->Dimensions[4]; i++ )
1774  {
1775  os << indent << indent << this->StripByteCount->GetValue(i) << "\n";
1776  }
1777 }
unsigned short Identifier
Definition: vtkLSMReader.h:404
int ReadInt(ifstream *, unsigned long &)
int ReadChannelDataTypes(ifstream *, unsigned long)
int AllocateChannelNames(int)
void DecodeHorizontalDifferencingUnsignedShort(unsigned short *, int)
#define TIFF_RATIONAL
Definition: vtkLSMReader.h:200
int Dimensions[5]
Definition: vtkLSMReader.h:396
vtkUnsignedIntArray * StripOffset
Definition: vtkLSMReader.h:377
#define VTK_FILE_BYTE_ORDER_BIG_ENDIAN
Definition: vtkLSMReader.h:206
#define SUBBLOCK_DETECTION_CHANNELS
Definition: vtkLSMReader.h:95
void NeedToReadHeaderInformationOff()
int FindChannelNameStart(const char *, int)
#define SUBBLOCK_TRACK
Definition: vtkLSMReader.h:94
int CharPointerToInt(char *)
#define TRACK_ENTRY_NAME
Definition: vtkLSMReader.h:164
int NumberOfIntensityValues[4]
Definition: vtkLSMReader.h:397
vtkUnsignedIntArray * ChannelDataTypes
Definition: vtkLSMReader.h:378
vtkIntArray * ChannelColors
Definition: vtkLSMReader.h:417
#define RECORDING_ENTRY_OBJETIVE
Definition: vtkLSMReader.h:112
#define SUBBLOCK_END
Definition: vtkLSMReader.h:107
int ReadLSMSpecificInfo(ifstream *, unsigned long)
unsigned long ReadImageDirectory(ifstream *, unsigned long)
virtual void PrintSelf(ostream &os, vtkIndent indent)
const char * GetDataByteOrderAsString()
unsigned short PlanarConfiguration
Definition: vtkLSMReader.h:405
#define TIF_IMAGELENGTH
Definition: vtkLSMReader.h:77
void ClearFileName()
#define SUBBLOCK_ILLUMINATION_CHANNEL
Definition: vtkLSMReader.h:98
int TIFF_BYTES(unsigned short)
unsigned long SeekFile(unsigned long)
unsigned long GetSliceOffset(unsigned int timepoint, unsigned int slice)
std::streamsize ReadFile(ifstream *, unsigned long &, unsigned int, char *, bool swap=false)
int GetHeaderIdentifier()
#define TIF_CZ_LSMINFO
Definition: vtkLSMReader.h:87
#define SUBBLOCK_TIMER
Definition: vtkLSMReader.h:104
#define DETCHANNEL_ENTRY_DETECTOR_GAIN_FIRST
Definition: vtkLSMReader.h:151
#define TIF_PHOTOMETRICINTERPRETATION
Definition: vtkLSMReader.h:80
int RequestUpdateExtent(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void NeedToReadHeaderInformationOn()
#define LSM_MAGIC_NUMBER
Definition: vtkLSMReader.h:202
char * Description
Definition: vtkLSMReader.h:421
#define DETCHANNEL_DETECTION_CHANNEL_NAME
Definition: vtkLSMReader.h:155
#define TIFF_ASCII
Definition: vtkLSMReader.h:197
ifstream * GetFile()
#define RECORDING_ENTRY_DESCRIPTION
Definition: vtkLSMReader.h:157
void SetUpdateTimePoint(int)
#define SUBBLOCK_LASERS
Definition: vtkLSMReader.h:91
int NeedToReadHeaderInformation()
double ReadDouble(ifstream *, unsigned long &)
std::streamsize ReadData(ifstream *, unsigned long &, unsigned int, char *)
vtkUnsignedIntArray * StripByteCount
Definition: vtkLSMReader.h:379
short CharPointerToShort(char *)
#define TIF_STRIPOFFSETS
Definition: vtkLSMReader.h:81
vtkDoubleArray * TimeStampInformation
Definition: vtkLSMReader.h:419
unsigned short ReadUnsignedShort(ifstream *, unsigned long &)
double VoxelSizes[3]
Definition: vtkLSMReader.h:383
unsigned int Compression
Definition: vtkLSMReader.h:394
double DataSpacing[3]
Definition: vtkLSMReader.h:412
char ** ChannelNames
Definition: vtkLSMReader.h:418
int ReadChannelColorsAndNames(ifstream *, unsigned long)
#define SUBBLOCK_BEAM_SPLITTER
Definition: vtkLSMReader.h:100
#define printf
Definition: hoverpoints.cpp:82
#define ILLUMCHANNEL_DETCHANNEL_NAME
Definition: vtkLSMReader.h:161
unsigned long ChannelDataTypesOffset
Definition: vtkLSMReader.h:388
#define SUBBLOCK_MARKERS
Definition: vtkLSMReader.h:105
#define DETCHANNEL_ENTRY_INTEGRATION_MODE
Definition: vtkLSMReader.h:153
vtkStringArray * LaserNames
Definition: vtkLSMReader.h:369
void SetDataByteOrderToBigEndian()
int GetNumberOfTimePoints()
char * GetChannelName(int)
int ReadChannelName(const char *, int, char *)
int GetNumberOfChannels()
unsigned long NumberOfLastAccessedImage
Definition: vtkLSMReader.h:389
#define ILLUMCHANNEL_ENTRY_AQUIRE
Definition: vtkLSMReader.h:160
unsigned short Predictor
Definition: vtkLSMReader.h:406
int ReadScanInformation(ifstream *, unsigned long)
#define TIF_NEWSUBFILETYPE
Definition: vtkLSMReader.h:75
#define SUBBLOCK_TRACKS
Definition: vtkLSMReader.h:93
#define TRACK_ENTRY_ACQUIRE
Definition: vtkLSMReader.h:163
char * Objective
Definition: vtkLSMReader.h:420
double CharPointerToDouble(char *)
unsigned short PhotometricInterpretation
Definition: vtkLSMReader.h:403
unsigned short CharPointerToUnsignedShort(char *)
int AnalyzeTag(ifstream *, unsigned long)
#define TIFF_SHORT
Definition: vtkLSMReader.h:198
vtkDoubleArray * TrackWavelengths
Definition: vtkLSMReader.h:371
#define TIF_STRIPBYTECOUNTS
Definition: vtkLSMReader.h:83
#define TIF_IMAGEWIDTH
Definition: vtkLSMReader.h:76
#define TIF_PLANARCONFIGURATION
Definition: vtkLSMReader.h:84
vtkUnsignedLongArray * ImageOffsets
Definition: vtkLSMReader.h:375
unsigned long ChannelInfoOffset
Definition: vtkLSMReader.h:387
vtkImageData * GetTimePointOutput(int, int)
void DecodeHorizontalDifferencing(unsigned char *, int)
vtkUnsignedLongArray * ReadSizes
Definition: vtkLSMReader.h:376
#define SUBBLOCK_DATA_CHANNELS
Definition: vtkLSMReader.h:101
short ReadShort(ifstream *, unsigned long &)
void ConstructSliceOffsets()
#define TIF_SAMPLESPERPIXEL
Definition: vtkLSMReader.h:82
unsigned long ColorMapOffset
Definition: vtkLSMReader.h:386
int RequestData(vtkInformation *vtkNotUsed(request), vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector)
int ReadTimeStampInformation(ifstream *, unsigned long)
#define DETCHANNEL_ENTRY_ACQUIRE
Definition: vtkLSMReader.h:154
#define SUBBLOCK_LASER
Definition: vtkLSMReader.h:92
#define SUBBLOCK_MARKER
Definition: vtkLSMReader.h:106
vtkStandardNewMacro(vtkLSMReader)
void SetDataByteOrder(int)
ifstream * File
Definition: vtkLSMReader.h:409
#define TIFF_LONG
Definition: vtkLSMReader.h:199
void SetUpdateChannel(int)
#define ILLUMCHANNEL_ENTRY_WAVELENGTH
Definition: vtkLSMReader.h:159
#define LASER_ENTRY_NAME
Definition: vtkLSMReader.h:147
int RequestInformation(vtkInformation *vtkNotUsed(request), vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector)
#define SUBBLOCK_BEAM_SPLITTERS
Definition: vtkLSMReader.h:99
unsigned int NewSubFileType
Definition: vtkLSMReader.h:393
double TimeInterval
Definition: vtkLSMReader.h:422
#define TYPE_SUBBLOCK
Definition: vtkLSMReader.h:165
unsigned int GetUpdateChannel()
unsigned int ReadUnsignedInt(ifstream *, unsigned long &)
#define TIF_PREDICTOR
Definition: vtkLSMReader.h:85
#define VTK_FILE_BYTE_ORDER_LITTLE_ENDIAN
Definition: vtkLSMReader.h:207
#define SUBBLOCK_DETECTION_CHANNEL
Definition: vtkLSMReader.h:96
vtkUnsignedShortArray * BitsPerSample
Definition: vtkLSMReader.h:381
#define DETCHANNEL_ENTRY_DETECTOR_GAIN_LAST
Definition: vtkLSMReader.h:152
char * FileName
Definition: vtkLSMReader.h:410
unsigned long GetOffsetToImage(int, int)
#define LSM_COMPRESSED
Definition: vtkLSMReader.h:204
int GetDataTypeForChannel(unsigned int channel)
#define SUBBLOCK_TIMERS
Definition: vtkLSMReader.h:103
unsigned int CharPointerToUnsignedInt(char *)
#define SUBBLOCK_ILLUMINATION_CHANNELS
Definition: vtkLSMReader.h:97
#define TIF_COLORMAP
Definition: vtkLSMReader.h:86
unsigned long GetStripByteCount(unsigned int timepoint, unsigned int slice)
bool IsValidLSMFile()
int GetDataByteOrder()
void DecodeLZWCompression(unsigned char *, int)
unsigned int LSMSpecificInfoOffset
Definition: vtkLSMReader.h:392
void SetDataByteOrderToLittleEndian()
#define TIF_BITSPERSAMPLE
Definition: vtkLSMReader.h:78
unsigned char CharPointerToUnsignedChar(char *)
int ClearChannelNames()
#define TIFF_BYTE
Definition: vtkLSMReader.h:196
#define SUBBLOCK_DATA_CHANNEL
Definition: vtkLSMReader.h:102
void SetFileName(const char *)
int SetChannelName(const char *, int)
int NumberOfScalarComponents
Definition: vtkLSMReader.h:414
int BYTES_BY_DATA_TYPE(int)
int DataExtent[6]
Definition: vtkLSMReader.h:413
int IntUpdateExtent[6]
Definition: vtkLSMReader.h:399
unsigned int SamplesPerPixel
Definition: vtkLSMReader.h:391
#define TIF_COMPRESSION
Definition: vtkLSMReader.h:79
unsigned short ScanType
Definition: vtkLSMReader.h:407
void CalculateExtentAndSpacing(int extent[6], double spacing[3])
int GetChannelColorComponent(int, int)
unsigned long OffsetToLastAccessedImage
Definition: vtkLSMReader.h:385
#define SUBBLOCK_RECORDING
Definition: vtkLSMReader.h:90