[Insight-users] How to define global ITK variable for differentcxx files

alex Dowson alexdowson at hotmail.com
Wed Apr 4 09:36:04 EDT 2012


Hi


1) first.cpp

RescaleFilterType::Pointer rescaler;

// Create the Rescaler some where in fuction i.e. constructor

First::First()
{
    RescaleFilterType::Pointer rescaler1 = RescaleFilterType::
}


2) second.cpp

extern RescaleFilterType::Pointer rescaler;




-----Original Message----- 
From: Xiaopeng Yang
Sent: Wednesday, April 04, 2012 6:58 PM
To: 'alex Dowson' ; 'John Drescher'
Cc: insight-users at itk.org
Subject: RE: [Insight-users] How to define global ITK variable for 
differentcxx files

I would like to use rescaler1 in another two different cxx files.

-----Original Message-----
From: alex Dowson [mailto:alexdowson at hotmail.com]
Sent: Wednesday, April 04, 2012 10:25 PM
To: Xiaopeng Yang; 'John Drescher'
Cc: insight-users at itk.org
Subject: Re: [Insight-users] How to define global ITK variable for
differentcxx files

Hi

What exactly you trying to do with that ?




-----Original Message-----
From: Xiaopeng Yang
Sent: Wednesday, April 04, 2012 6:52 PM
To: 'John Drescher'
Cc: insight-users at itk.org
Subject: Re: [Insight-users] How to define global ITK variable for
differentcxx files

I tried as follows. But I am not sure it is right or not.

// globals.h

#ifndef GLOBALS_H
#define GLOBALS_H

#ifndef EXTERN
#define EXTERN extern
#endif


#include <itkImage.h>

#include "itkRescaleIntensityImageFilter.h"

typedef    float    InputPixelType;

typedef itk::Image< InputPixelType,  3 >   InputImageType;

typedef itk::RescaleIntensityImageFilter<
             InputImageType, InputImageType > RescaleFilterType;

EXTERN RescaleFilterType::Pointer rescaler1 = RescaleFilterType::

#endif

Thanks.

-----Original Message-----
From: John Drescher [mailto:drescherjm at gmail.com]
Sent: Wednesday, April 04, 2012 10:03 PM
To: Xiaopeng Yang
Cc: insight-users at itk.org
Subject: Re: [Insight-users] How to define global ITK variable for different
cxx files

> Assume that I have two cxx files: a.cxx and b.cxx and two head files:
> a.h and b.h.
>
>
>
> I would like to define a global itk reader in a and then use that
> reader in b.
>
>
>
> How to achieve this?
>

Add a third header file defining the global.

John







_____________________________________
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://www.itk.org/mailman/listinfo/insight-users










More information about the Insight-users mailing list