Hi Michael,<br><br>We have the following "large image" tests in<br>the directory <br><br> Insight/Testing/Code/IO<br><br>The filename is:<br><br> itkLargeImageWriteReadTest.cxx<br><br>and the CMakeLists.txt file runs in with <br>
two sizes:<br><br><br>IF( ${ITK_COMPUTER_MEMORY_SIZE} GREATER 5 )<br><br> # Just below 2 Gigabytes<br> ADD_TEST(itkLargeImageWriteReadTest1 ${IO_TESTS} itkLargeImageWriteReadTest<br> ${ITK_TEST_OUTPUT_DIR}/LargeImage01.mhd 30000L )<br>
<br> # Just above 2 Gigabytes<br> ADD_TEST(itkLargeImageWriteReadTest2 ${IO_TESTS} itkLargeImageWriteReadTest<br> ${ITK_TEST_OUTPUT_DIR}/LargeImage02.mhd 40000L )<br><br>ENDIF( ${ITK_COMPUTER_MEMORY_SIZE} GREATER 5 )<br>
<br><br>As you can see, this is conditioned to the CMake variable<br>ITK_COMPUTER_MEMORY_SIZE.<br><br>Could you please use CMake to set this variable to a value == 6,<br>(since your machine has 6Gb), and run the tests ?<br>
<br>We run them normally on a 16Gb machine.<br><br> Please let us know what you find.<br><br><br>I'm going through the changes for using "size_t", and<br>will add a third "large image" test for checking images<br>
above 8Gb in size.<br><br><br>We will see how it goes...<br><br><br> Luis<br><br><br>---------------------------------------------------------------------<br><div class="gmail_quote">On Fri, Jul 10, 2009 at 1:21 PM, Michael Jackson <span dir="ltr"><<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</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;">"contributing" was being nice ;-). Sorry about that, had a long week. Actually you just need to create an image that is 2^32 + 1 in size. I tried to get something like this done in VTK but it ended up being a true API change which never happened.<br>
<br>
Let me know how the test goes. If you need another machine I have a 6GB Mac Pro that I can setup to run a few tests if needed.<br>
<br>
Thanks for the quick feedback. I think these changes, while possibly being a bit disruptive _now_ will save lots of bugs/issues in the future.<br>
<br>
Cheers.<div class="im"><br>
_________________________________________________________<br>
Mike Jackson <a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a><br>
<br>
<br></div><div><div></div><div class="h5">
On Jul 10, 2009, at 1:01 PM, Luis Ibanez wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi Michael,<br>
<br>
<br>
Thanks for contributing to this topic.<br>
<br>
<br>
I'm running an experimental build by using "size_t" in<br>
replacement for "long". (on a Windows 64-bits machine).<br>
<br>
This, most likely will trigger a cascade of changes<br>
in other places where replacing "long" with "size_t"<br>
will be required to provide consistency.<br>
<br>
<br>
To be completely sure, we should add a test that is<br>
equivalent to what promted Kana to post his question<br>
to the list. E.g. creating an image of 8Gb or larger.<br>
<br>
<br>
<br>
Luis<br>
<br>
<br>
<br>
-----------------------<br>
Michael Jackson wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<rant><br>
I am not a C++ expert by any stretch but with my limited 4 years of experience I have learned one thing. "Long" is the "root of all evil" ;-)<br>
IMNSHO, ITK (and VTK by extension) should absolutely BAN the use of "long" in their projects. Period. Too many avoidable bugs come up from its use. If you want a 32 bit integer use int or the standard ansi int type, if you want a 64 bit integer then use "long long int" or the standard ansi 64 bit integer type.<br>
"long int" is just a mess waiting to happen. Maybe a rule should be put into the KWStyle project to look for and flag the use of 'long'?<br>
</rant><br>
A few years back I spent the better part of 2 days tracking down an issue with VTK that turned out to be the same root problem. The use of "long" when "long long" was really needed. Every time I see something declared 'long' I then have to rethink the ramifications of using those classes or variables as I flip-flop between 32 and 64 bit compiles regularly.<br>
Just my thoughts on this friday. Take 'em or leave 'em.<br>
I vote for Luis Solution below. I _seems_ like it would solve the problem ..<br>
_________________________________________________________<br>
Mike Jackson <a href="mailto:mike.jackson@bluequartz.net" target="_blank">mike.jackson@bluequartz.net</a><br>
On Jul 10, 2009, at 12:30 PM, Luis Ibanez 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 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>
On Thu, Jul 9, 2009 at 2:53 AM, Arunachalam Kana <<a href="mailto:Kana.Arunachalam@fh-wels.at" target="_blank">Kana.Arunachalam@fh-wels.at</a> > wrote:<br>
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>
unsigned long tt;<br>
std::cout << "size = " << sizeof(tt) << std::endl;<br>
tt = -1;<br>
std::cout << "tt = " << tt << std::endl;<br>
output: size = 4; tt = 4294967295<br>
<br>
2. Program:<br>
unsigned long long tt;<br>
std::cout << "size = " << sizeof(tt) << std::endl;<br>
tt = -1;<br>
std::cout << "tt = " << tt << std::endl;<br>
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>
unsigned long tt;<br>
std::cout << "size = " << sizeof(tt) << std::endl;<br>
tt = -1;<br>
std::cout << "tt = " << tt << std::endl;<br>
output: size = 4; tt = 4294967295<br>
<br>
2. Program:<br>
unsigned long long tt;<br>
std::cout << "size = " << sizeof(tt) << std::endl;<br>
tt = -1;<br>
std::cout << "tt = " << tt << std::endl;<br>
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>