Hi Kana,<br><br>Thanks a lot for looking into this and sharing your findings.<br><br>I just confirmed that in Windows 64bits, the "long" type is<br>only 4 bytes.<br><br>Here is the program I used:<br><br>#include <iostream><br>
#include "itkOffset.h"<br>#include "itkNumericTraits.h"<br><br>int main()<br>{<br> unsigned long tt;<br> std::cout << "size = " << sizeof(tt) << std::endl;<br> tt = -1;<br>
std::cout << "tt = " << tt << std::endl;<br><br> typedef itk::Offset<3> OffsetType;<br> typedef OffsetType::OffsetValueType OffsetValueType;<br><br> OffsetValueType offsetValue;<br>
<br> std::cout << "sizeof(offsetValue) = " << sizeof( offsetValue ) << std::endl;<br><br> offsetValue = itk::NumericTraits< OffsetValueType >::max();<br><br> std::cout << "OffsetValueType max() = " << offsetValue << std::endl;<br>
<br> return EXIT_SUCCESS;<br>}<br><br><br>with this CMakeLists.txt file<br><br><br>CMAKE_MINIMUM_REQUIRED(VERSION 2.4)<br>IF(COMMAND CMAKE_POLICY)<br> CMAKE_POLICY(SET CMP0003 NEW)<br>ENDIF(COMMAND CMAKE_POLICY)<br><br>
<br>PROJECT(64bitsTest)<br><br>FIND_PACKAGE(ITK REQUIRED)<br>INCLUDE(${ITK_USE_FILE})<br><br>ADD_EXECUTABLE(typesTest typesTest.cxx )<br><br>TARGET_LINK_LIBRARIES(typesTest ITKCommon)<br><br><br><br>---------<br><br><br>So, it seems that we have to introduce a new ITK type,<br>
that will be the longest int available in the platform.<br><br><br>We currently have the following declarations in the file:<br><br> Insight/Code/Common/itkIntTypes.h<br><br><br> /** Convenient and more descriptive integer types. */<br>
typedef char ITK_INT8;<br> typedef int ITK_INT32;<br><br>#ifndef _WIN32<br> typedef long long ITK_INT64;<br>#endif<br><br>#ifdef _WIN32<br> typedef long ITK_INT64;<br>#endif<br><br> typedef unsigned char ITK_UINT8;<br>
typedef unsigned short ITK_UINT16;<br> typedef unsigned ITK_UINT32;<br><br>#ifndef _WIN32<br> typedef unsigned long long ITK_UINT64;<br>#endif<br><br>#ifdef _WIN32<br> typedef unsigned long ITK_UINT64;<br>#endif<br>
<br> typedef int ITK_INTPTR;<br> typedef unsigned ITK_UINTPTR;<br><br>#ifdef __cplusplus<br>}<br>#endif<br><br><br><br>One option that comes to mind is that we <br>should simply use <br><br><br> size_t<br>
or std::size_t<br><br>Which is the type expected by the "mem"<br>methods, {memcpy,memdup...}, and the<br>allocation "new" method.<br><br>I have verified that "size_t" will have 8 bits<br>
on Windows 64.<br><br> std::cout << "sizeof( size_t ) = " << sizeof( size_t ) << std::endl;<br><br><br><br>Unless there are any objections, I'll suggest<br>that we replace the type of all integer variables <br>
related to image offsets and image size, with<br>the type "size_t".<br><br><br>BTW: note that there is also "size_type"<br><br>It seems that "size_type" will be the type used by STL<br>containers.<br>
<br><br> Any comments ?<br><br><br> Thanks<br><br><br> Luis<br><br><br>------------------------------------------------------------------------------------------------------------<br><div class="gmail_quote">
On Thu, Jul 9, 2009 at 2:53 AM, Arunachalam Kana <span dir="ltr"><<a href="mailto:Kana.Arunachalam@fh-wels.at">Kana.Arunachalam@fh-wels.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Luis,<br>
<br>
Thank you for your response. I ran the test program and the given the<br>
results are given below along with detailed<br>
System information and what option i used to compile itk.<br>
<br>
System Information<br>
------------------<br>
Time of this report: 7/8/2009, 17:16:29<br>
Machine name: CT-DELL<br>
Operating System: Windows XP Professional x64 Edition (5.2, Build<br>
3790) Service Pack 2 (3790.srv03_sp2_gdr.090319-1204)<br>
Language: English (Regional Setting: German)<br>
System Manufacturer: Dell Inc.<br>
System Model: Precision WorkStation T7400<br>
BIOS: Default System BIOS<br>
Processor: Intel(R) Pentium(R) III Xeon-Prozessor (8 CPUs),<br>
~3.2GHz<br>
Memory: 65534MB RAM<br>
Page File: 717MB used, 65267MB available<br>
Windows Dir: C:\WINDOWS<br>
DirectX Version: DirectX 9.0c (4.09.0000.0904)<br>
DX Setup Parameters: Not found<br>
DxDiag Version: 5.03.3790.3959 32bit Unicode<br>
<br>
<br>
Itk compilation<br>
---------------------<br>
Itk compiled using Microsoft visual studio 2009 x64 (option).<br>
<br>
Microsoft visual studio 2008<br>
---------------------<br>
Configuration manager details:<br>
Active Solution Configuration: Debug<br>
Active Solution Platform: x64<br>
<br>
Test run details:<br>
1. Program:<br>
<div class="im"> unsigned long tt;<br>
std::cout << "size = " << sizeof(tt) << std::endl;<br>
tt = -1;<br>
std::cout << "tt = " << tt << std::endl;<br>
</div><div class="im"> output: size = 4; tt = 4294967295<br>
<br>
</div>2. Program:<br>
unsigned long long tt;<br>
<div class="im"> std::cout << "size = " << sizeof(tt) << std::endl;<br>
tt = -1;<br>
std::cout << "tt = " << tt << std::endl;<br>
</div> output: size = 8; tt = 18446744073709551615<br>
<br>
I changed the configuration details:<br>
--------------------------------------<br>
Active Solution Configuration: Debug<br>
Active Solution Platform: Win32<br>
<br>
Test run details:<br>
1. Program:<br>
<div class="im"> unsigned long tt;<br>
std::cout << "size = " << sizeof(tt) << std::endl;<br>
tt = -1;<br>
std::cout << "tt = " << tt << std::endl;<br>
</div><div class="im"> output: size = 4; tt = 4294967295<br>
<br>
</div>2. Program:<br>
unsigned long long tt;<br>
<div class="im"> std::cout << "size = " << sizeof(tt) << std::endl;<br>
tt = -1;<br>
std::cout << "tt = " << tt << std::endl;<br>
</div> output: size = 8; tt = 18446744073709551615<br>
<br>
For both Win32 and x64 i get the same result.<br>
Unsigned long is 4 byte and unsigned long long is 8 byte.<br>
<br>
I was a little confused after the result, so i searched for data type<br>
ranges in msdn. Link below:<br>
<br>
<a href="http://msdn.microsoft.com/en-us/library/s3f49ktz.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/s3f49ktz.aspx</a><br>
<br>