[Insight-developers] Best way to concatenate itk Arrays?

Michael Stauffer (Circular Logic) mstauff at verizon.net
Fri Dec 10 13:37:40 EST 2010


Thanks Luis, that sounds good.

Digger deeper I see actually that vnl_vector::copy_out is just using a
for loop to copy by element, so that's no advantage. What a tease! :)

Following Nick's use of data_block in BSplineDeformableTransform, I see
that ImportImageContainer ends up calling memcpy with this data pointer.
So it seems that's kosher for me to use too? Ill try that.

I'm not sure how STL would help me here (presumably you meant
containers?). Seems it might involve more copying than a direct memcpy
from Array to another Array.

-M

>-----Original Message-----
>From: Luis Ibanez [mailto:luis.ibanez at kitware.com] 
>Sent: Friday, December 10, 2010 12:22 PM
>To: Michael Stauffer (Circular Logic)
>Cc: Nicholas Tustison; ITK-dev-list
>Subject: Re: [Insight-developers] Best way to concatenate itk Arrays?
>
>Hi Michael,
>
>As long as the vnl code is not exposed in the ITK API,
>it should be fine.
>
>(...we have some places where this rule has note been
>respected and probably should clean them up...).
>
>You are also free to use STL inside the implementation
>code, if you find that useful for this case.
>
>
>     Luis
>
>
>-------------------------------------
>On Thu, Dec 9, 2010 at 5:43 PM, Michael Stauffer (Circular Logic)
><mstauff at verizon.net> wrote:
>> Thanks Nick. This is what I've used so far, along with 
>copy_out(). I was
>> checking to see if it's Kosher with itk best practices, since it's
>> relying on the underlying data type.
>>
>> Cheers,
>> Michael
>>
>>>-----Original Message-----
>>>From: Nicholas Tustison [mailto:ntustison at gmail.com]
>>>Sent: Thursday, December 09, 2010 4:38 PM
>>>To: Michael Stauffer (Circular Logic)
>>>Cc: 'ITK-dev-list'
>>>Subject: Re: [Insight-developers] Best way to concatenate itk Arrays?
>>>
>>>Hi Michael,
>>>
>>>You should look in the BSplineDeformableTransform class where
>>>the data_block() function is accessed directly.
>>>
>>>Nick
>>>
>>>
>>>On Dec 9, 2010, at 4:18 PM, Michael Stauffer (Circular Logic) wrote:
>>>
>>>> Hi,
>>>>
>>>> I need to concatenate itk Arrays (Transform::ParameterType objects,
>>>> actually) into a single new Array. Is it acceptable to
>>>directly use the
>>>> underlying public vnl_vector routines like data_block() and
>>>copy_out()
>>>> to do this efficiently? Or must I copy element-by-element using
>>>> Array::GetElement(). Or is there some other way I'm missing?
>>>>
>>>> I could add an Insert method to Array that allows inserting
>>>of another
>>>> array at a given index, in order to avoid using the
>>>vnl_vector routines
>>>> directly.
>>>>
>>>> This is part of the new CompositeTransform class. We're set-ing and
>>>> get-ing concatenated parameter arrays that hold the
>>>parameters for all
>>>> the constituent transforms in the composite class. We may
>>>have dozens of
>>>> transforms at once, so element-by-element copying will start
>>>to add up
>>>> over all the calls to get and set parameters made by the 
>optimizer in
>>>> the registration process.
>>>>
>>>> Cheers,
>>>> Michael
>>>>
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://kitware.com/products/protraining.html
>>>>
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>



More information about the Insight-developers mailing list