[Insight-developers] BillsBasement Nightly Failing Test

Bradley Lowekamp blowekamp at mail.nih.gov
Tue Feb 24 17:58:56 EST 2009


On Feb 24, 2009, at 5:36 PM, Luis Ibanez wrote:
>
>
> Feel free to go ahead an review the code for
> min dimension. It will be great is you write
> it using the methods above, that now have
> bounds checking.

Done:

itkImageFileReaderTest2.cxx Revision: 1.1

It's actually 2D or 3D to 4D, then 4D to 3D.
For some of the file formats I was interested there was not a pre- 
existing 2D file. As long at the format support 4D images this test  
can be used.

>
>
> And we have to add two explicit test
> that do:
>
>   Read a 2D image into a 3D image
>   Read a 3D image into a 2D image
>
> In that way we can verify that the code is
> doing the right thing in both cases.
>
>
> BTW: At the end, you are using this code to
> figure out if the filter is currently streaming,
> isn't it ?
>
>
> It would probably be more appropriate to put
> this into a bool method with a description
> name (related to streaming).
>

Yes, that is the reason for this mess. I would think that this should  
be a ImageIOBase private method:

bool IsIORegionLargestRegion(void) const;

>
> BTW: Do you think that the registration failing tests in
>      mini3.nlm may be related in any way to these IO changes ?

I mucked with the configuration on Friday and turned on some options.  
For tomorrow, I turned off the optimized registration. If you have any  
recommendation for the cmake options let me know. I think one of this  
options I enable has some kind of issue.

Brad



> Bradley Lowekamp wrote:
>> Hello,
>>
>> Should I finish up this or are you taking care of it all?
>>
>> This is what I came up with for this section of code, incorporating  
>> your
>> RegionIO safety:
>>
>> // this is a check to see if we are actually streaming
>>  ImageIORegion largestRegion(nDims);
>>  for(unsigned int i=0; i<nDims; i++)
>>    {
>>    largestRegion.SetIndex(i, 0);
>>    largestRegion.SetSize(i, this->GetDimensions(i));
>>    }
>>
>>  // since largestRegion and m_IORegion may not be the same dimensions
>>  // we must be very careful in comparision and asignment to
>>  // indexMin/indexMax
>>  if(largestRegion.IsEqualWithRegionDimension(m_IORegion))
>>    {
>>    int* indexMin = new int[nDims];
>>    int* indexMax = new int[nDims];
>>    for(unsigned int i=0;i<nDims;i++)
>>      {
>>      if ( i < m_IORegion.GetImageDimension() )
>>        {
>>        indexMin[i] = static_cast<int>(m_IORegion.GetIndex(i));
>>        indexMax[i] = static_cast<int>(indexMin[i] +
>> m_IORegion.GetSize(i) - 1);
>>        }
>>      else
>>        {
>>        indexMin[i] = 0;
>>        // this is zero since this is a (size - 1)
>>        indexMax[i] = 0;
>>        }
>>      }
>>
>> I also did a similar things in the write method too.
>>
>> On Feb 24, 2009, at 9:55 AM, Lowekamp, Bradley (NIH/NLM/LHC) [C]  
>> wrote:
>>
>>> Luis,
>>>
>>> I agree we should add more tests. I thought I added enough IO  
>>> tests :)
>>> Should this just be for meta or test it with a bunch of types? I  
>>> can't
>>> think of a way to validate this except valgrind and std lib debug.
>>>
>>>
>>> Based on this methods:
>>>
>>>  /** Dimension of the region to be written. This differs from the
>>>   * the image dimension and is calculated at run-time by examining
>>>   * the size of the image in each coordinate direction. */
>>>  unsigned int ImageIORegion::GetRegionDimension() const
>>>
>>> I think we should add:
>>>
>>> /* Performs element by element comparison up to the  
>>> GetRegionDimension()
>>> * This is equivalent to removing any trailing ones, then doing a
>>> operator==
>>> */
>>> bool ImageIORegion::IsEqualWithRegionDimension(const Self &) const
>>>
>>>
>>> There are clear use cases for this for reading. But there is
>>> also similar code for writing, is this need? In itkImageFileWriter
>>> there is a check to make sure the paste region is inside the  
>>> largest.
>>> This is enforce the IORegions are the same image dimension. So it  
>>> may
>>> not be, but if we have IsEqualWithRegionDimension is east todo.
>>>
>>> minIndex and maxIndex need to be padded with 1 up to nDims. This is
>>> because metaIO has been initialized with nDims and is expecting  
>>> things
>>> to be of that size!
>>>
>>> Brad
>>>
>>>
>>> On Feb 24, 2009, at 8:16 AM, Luis Ibanez wrote:
>>>
>>>>
>>>> Brad,
>>>>
>>>> mm,...
>>>> I don't see how...,
>>>>
>>>> minIndex and maxIndex are populated with values taken from
>>>>
>>>>               m_IORegion.GetIndex()[i];
>>>>
>>>> so, there is no way to use more elements that the ones
>>>> contained in m_IORegion...
>>>>
>>>>
>>>> I think we should add a formal test to IO for
>>>>
>>>>    * Reading a 2D image file into a 3D image type
>>>>    * Reading a 3D image file into a 2D image type
>>>>
>>>> This will illustrate both cases, and then we can verify if
>>>> the behavior is correct.
>>>>
>>>>     Luis
>>>>
>>>>
>>>> ----------------------------------------------------------------------------------
>>>> On Mon, Feb 23, 2009 at 11:19 PM, Bradley Lowekamp
>>>> <blowekamp at mail.nih.gov <mailto:blowekamp at mail.nih.gov>> wrote:
>>>>
>>>>    I think that indexMin and indexMax still need to be nDims size.?
>>>>
>>>>    I agree that it make since to make this type of comparison part
>>>>    of the ImageIORegion API. As that is the only reason for this
>>>>     issue it to remove padded 1's at the end.
>>>>
>>>>
>>>>    On Feb 23, 2009, at 11:10 PM, Luis Ibanez wrote:
>>>>

Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090224/9b0d7995/attachment.htm>


More information about the Insight-developers mailing list