[Insight-users] Arrays of ListSample, with smartPointer

Luis Ibanez luis.ibanez at kitware.com
Mon Jan 10 10:29:02 EST 2005


Hi Lagaffe,

The New() operator is a static one.

You invoke static operator by using their classname,
not an object of the class.


The code that you need is the following:

    typedef SampleType::Pointer SamplePointer;
    SamplePointer myArray[NumberOfRegions];

    for( int i=0; i<NumberOfRegions; i++ )
      {
      myArray[i]  = SampleType::New();
      }



Regards,


    Luis


-----------------
Lagaffe wrote:

> Thanks Luis,
> but how to you create the New Operation ? I did
> something but it does not work:
> 
> int NumberOfRegions=5;
> typedef
> itk::Statistics::ListSample<MeasurementVectorType >
> SampleType;
> typedef SampleType::Pointer   SamplePointer;
> SamplePointer myArray[NumberOfRegions];
> for(int i=0;i<NumberOfRegions;i++) {
> 	myArray[i]::New();
> }
> 
> thanks
> 
> Lagaffe
> 
>  --- Luis Ibanez <luis.ibanez at kitware.com> a écrit : 
> 
>>Hi Lagaffe,
>>
>>
>>   1) Define the Sample type
>>   2) Define the Pointer type
>>   3) Instantiate an array
>>
>>
>>It will look like:
>>
>>
>>
>>     // Type definition:
>>     typedef itk::Statistics::ListSample<..>
>>SampleType;
>>
>>
>>     // Pointer type definition:
>>     typedef SampleType::Pointer       
>>SamplePointer;
>>
>>
>>     // Array declaration:
>>     SamplePointer    myArray[10];
>>
>>
>>
>>Regards,
>>
>>
>>     Luis
>>
>>
>>
>>--------------------
>>Lagaffe wrote:
>>
>>
>>>Hello,
>>> 
>>>How can I create an Array of ListSample ?
>>>For just one, there is no problem but I don't know
>>
>>how to create an 
>>
>>>array with the SmartPointer strategy.
>>> 
>>>typedef itk::Statistics::ListSample<..>
>>
>>SampleType;
>>
>>>SampleType::Pointer sample=SampleType::New();
>>> 
>>>if  I try something like
>>>typedef itk::Statistics::ListSample<..>
>>
>>SampleType[5];
>>
>>>After, I don't know how to instantiate it.
>>> 
>>>thanks
>>> 
>>>lagaffe
>>> 
>>> 
>>>
>>>
>>
> ------------------------------------------------------------------------
> 
>>>Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace
>>
>>de stockage pour vos 
>>
>>>mails !
>>>Créez votre Yahoo! Mail 
>>>
>>
> <http://fr.rd.yahoo.com/mail/taglines/*http://fr.rd.yahoo.com/evt=25917/*http://fr.rd.yahoo.com/mail_fr/mail_campaigns/splash/taglines_250/default/*http://fr.promotions.yahoo.com/mail/creer28.html>
> 
>>>
>>>
>>>
> ------------------------------------------------------------------------
> 
>>>_______________________________________________
>>>Insight-users mailing list
>>>Insight-users at itk.org
>>>http://www.itk.org/mailman/listinfo/insight-users
>>
>>
>>
>>
>> 
> 
> 
> 
> 	
> 
> 	
> 		
> Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails ! 
> Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 






More information about the Insight-users mailing list