Skip to content

Commit 8012ade

Browse files
committed
Merge remote-tracking branch 'blowekamp/ForSlicerUpdateTiffIO' into slicer-v4.6.0-2014-09-19-554e46a
* blowekamp/ForSlicerUpdateTiffIO: (24 commits) COMP: Add explicit conversion to const char BUG: Support TIFF tiled image with TIFFReadRGBAImage ENH: Query libtiff to determine compression support ENH: adding TIFFImageIO test for RGB palette images BUG: Adding missing parentheses around boolean expression PERF: Refactor color table lookup ENH: Refactor per pixel conversion function to per scan-line method ENH: RGBA read images should stay unchanged. ENH: Remove support for TIFF tile as 3D and dead code BUG: Address Coverity warning about null pointer dereferences ENH: Reduce code duplicate in TIFFImageIO::ReadCurrentPage ENH: add arbitrary TIFF TAGs to meta-data dictionary BUG: Use array delete operator for array new allocations STYLE: Fix minor kwstyle defects in test and test results ENH: Include TIFF tags in the MetaDataDictionary BUG: Remove dead separated plannar code, add test BUG: Fix right oriented tiff images ENH: Refactor duplicated code to read a page ENH: Refactor method to convert RGBA image to output buffer BUG: Remove Zeiss 2-channel support code in TIFFImageIO ( and LSMImageIO ) ...
2 parents 56fae27 + 48a677f commit 8012ade

21 files changed

+1222
-1362
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE Change SYSTEM "http://itk.org/migrationv4/ITKMigration.dtd">
3+
4+
<!--**
5+
**
6+
** TIFFZeiss2Channel.xml
7+
**
8+
** >>>>>>>>>>>>>>>>>>>>>>>>>>>>
9+
** THIS FILE HAS BEEN AUTOMATICALLY GENERATED. EDIT IT BEFORE COMMITING
10+
** <<<<<<<<<<<<<<<<<<<<<<<<<<<
11+
**
12+
** Please, make sure this file validates the following w3c test before committing it: http://validator.w3.org
13+
**-->
14+
<Change>
15+
<!--**
16+
** Title for the online migration page
17+
**-->
18+
<Title>
19+
TIFF Zeiss 2-Channel
20+
</Title>
21+
22+
<!--**
23+
** The author of the change
24+
**-->
25+
<Author>
26+
Bradley Lowekamp
27+
</Author>
28+
29+
<!--**
30+
** Date of creation for the XML document
31+
**-->
32+
<Date>
33+
2014-09-18
34+
</Date>
35+
36+
<!--**
37+
** Plain text description of the change
38+
** Extracted from git commit messages
39+
**-->
40+
<Description>
41+
<![CDATA[
42+
BUG: Remove Zeiss 2-channel support code in TIFFImageIO ( and LSMImageIO )
43+
There are no tests for this branch of code. It only works in 3D under
44+
certain cases. There are apparent bugs in the code such as not setting
45+
all of the input image, and logically dead branches. Some downloaded
46+
test images for similar described format do not load. This may effect
47+
files with the extensions tif, tiff, or lsm.
48+
49+
Removal of this code will enable expansion of the current code to more
50+
generically support multi-sample per pixel images.
51+
52+
For more robust reading of this type of image the SCIFIO remote
53+
module should be used.
54+
55+
]]>
56+
</Description>
57+
58+
<!--**
59+
** Sample code snippets
60+
** Extracted from git diff of changed files in Examples and Testing
61+
**-->
62+
<SampleCode>
63+
<Old>
64+
<![CDATA[
65+
]]>
66+
</Old>
67+
68+
<New>
69+
<![CDATA[
70+
]]>
71+
</New>
72+
73+
</SampleCode>
74+
75+
<!--**
76+
** The change-ids for all commits in the topic branch
77+
**-->
78+
<Gerrit-ChangeId>
79+
Idb98d69538db3bc8520881ea4a5e22476238c41e
80+
</Gerrit-ChangeId>
81+
82+
<!--**
83+
** List of all changed files from the topic branch
84+
**-->
85+
<FileList>
86+
Modules/IO/TIFF/include/itkTIFFImageIO.h
87+
Modules/IO/TIFF/src/itkTIFFImageIO.cxx
88+
</FileList>
89+
90+
</Change>

Modules/IO/TIFF/include/itkTIFFImageIO.h

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ class ITKIOTIFF_EXPORT TIFFImageIO:public ImageIOBase
6969
/** Reads 3D data from multi-pages tiff. */
7070
virtual void ReadVolume(void *buffer);
7171

72-
/** Reads 3D data from tiled tiff. */
73-
virtual void ReadTiles(void *buffer);
74-
7572
/*-------- This part of the interfaces deals with writing data. ----- */
7673

7774
/** Determine the file type. Returns true if this ImageIO can read the
@@ -141,19 +138,17 @@ class ITKIOTIFF_EXPORT TIFFImageIO:public ImageIOBase
141138
void InitializeColors();
142139

143140
void ReadGenericImage(void *out,
144-
unsigned int itkNotUsed(width),
141+
unsigned int width,
145142
unsigned int height);
146143

147144
// To support Zeiss images
148145
void ReadTwoSamplesPerPixelImage(void *out,
149-
unsigned int itkNotUsed(width),
146+
unsigned int width,
150147
unsigned int height);
151148

152-
int EvaluateImageAt(void *out, void *in);
153-
154149
unsigned int GetFormat();
155150

156-
void GetColor(int index, unsigned short *red,
151+
void GetColor(unsigned int index, unsigned short *red,
157152
unsigned short *green, unsigned short *blue);
158153

159154
// Check that tag t can be found
@@ -164,13 +159,46 @@ class ITKIOTIFF_EXPORT TIFFImageIO:public ImageIOBase
164159

165160
TIFFReaderInternal *m_InternalImage;
166161

162+
void ReadTIFFTags();
163+
167164
int m_Compression;
168165
int m_JPEGQuality;
169166

170167
private:
171168
TIFFImageIO(const Self &); //purposely not implemented
172169
void operator=(const Self &); //purposely not implemented
173170

171+
void ReadCurrentPage(void *out, size_t pixelOffset);
172+
173+
template <typename TComponent>
174+
void ReadGenericImage(void *out,
175+
unsigned int width,
176+
unsigned int height);
177+
178+
template <typename TComponent>
179+
void RGBAImageToBuffer( void *out, const uint32_t *tempImage );
180+
181+
template <typename TType>
182+
void PutGrayscale( TType *to, TType * from,
183+
unsigned int xsize, unsigned int ysize,
184+
unsigned int toskew, unsigned int fromskew );
185+
186+
template <typename TType>
187+
void PutRGB_( TType *to, TType * from,
188+
unsigned int xsize, unsigned int ysize,
189+
unsigned int toskew, unsigned int fromskew );
190+
191+
192+
template <typename TType, typename TFromType>
193+
void PutPaletteGrayscale( TType *to, TFromType * from,
194+
unsigned int xsize, unsigned int ysize,
195+
unsigned int toskew, unsigned int fromskew );
196+
197+
template <typename TType, typename TFromType>
198+
void PutPaletteRGB( TType *to, TFromType * from,
199+
unsigned int xsize, unsigned int ysize,
200+
unsigned int toskew, unsigned int fromskew );
201+
174202
unsigned short *m_ColorRed;
175203
unsigned short *m_ColorGreen;
176204
unsigned short *m_ColorBlue;

Modules/IO/TIFF/src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(ITKIOTIFF_SRC
22
itkTIFFImageIO.cxx
3+
itkTIFFReaderInternal.cxx
34
itkTIFFImageIOFactory.cxx
45
)
56

0 commit comments

Comments
 (0)