[ITK-users] simpleitk question C#

Bradley Lowekamp brad at lowekamp.net
Fri Aug 5 22:06:24 EDT 2016


Hi

This suggestion has the arguments backwards:
http://en.cppreference.com/w/cpp/container/vector/vector

This line creates an std::vector of Dimension size and fills it with the value of 8. 

You can use the for loop to fill the array as suggested or use an array initializer if the array size is fixed.

HTH
Brad

> On Aug 5, 2016, at 10:05 AM, Dženan Zukić <dzenanz at gmail.com> wrote:
> 
> Hi Anton,
> 
> I don't know C#'s syntax that well to give you direct translation, but here is another way to write the same C++ code which should be easier to translate:
> 
> std::vector<unsigned int> transfromDomainMeshSize;
> //C# eqivalent: unsigned int[] transfromDomainMeshSize;
> transfromDomainMeshSize.resize(8);
> //my stab in C#: transfromDomainMeshSize=new unsigned int[8];
> for (int i=0; i<8; i++)
>   transfromDomainMeshSize[i]=fixed.GetDimension();
> 
> HTH,
> Dženan
> 
>> On Fri, Aug 5, 2016 at 9:40 AM, Anton Delehony <anton.delehony at gmail.com> wrote:
>> Hi all, 
>> 
>> I'm a new to C# and simple itk and have a very simple question.
>> 
>> in the ImageRegistrationMethodBSpline1.cxx there is the line:
>> 
>> std::vector<unsigned int> transfromDomainMeshSize(fixed.GetDimension(),8);
>> 
>> What is the equivlent line to this in C#?
>> 
>> thanks,
>> 
>> Anton
>> 
>> _____________________________________
>> 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://www.kitware.com/products/protraining.php
>> 
>> 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://public.kitware.com/mailman/listinfo/insight-users
> 
> _____________________________________
> 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://www.kitware.com/products/protraining.php
> 
> 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://public.kitware.com/mailman/listinfo/insight-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20160805/c83bab75/attachment.html>


More information about the Insight-users mailing list