[Insight-users] help needed please!
lydia coin
lydia_coin3d@yahoo.fr
Wed, 18 Dec 2002 16:08:02 +0100 (CET)
--0-1612891888-1040224082=:91036
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Could anyone tell what's wrong with these lines. I'm stagnating since yesterday and no solution is suggested to my problem. Please it is urgent
/*** this is for importing pixel values from an unsigned char type pointer **/
itk::ImportImageContainer<long unsigned int, unsigned char>::Pointer import;
import = itk::ImportImageContainer<long unsigned int, unsigned char>::New();
import->Initialize();
import->Reserve(size[0]*size[1]);
import->SetImportPointer(labeled_image2,size[0]*size[1],false);
/****setting the pixel values in the itkimage****/
typedef itk::Image<unsigned char, 2> ImageType;
ImageType:: Pointer img = ImageType::New();
double values[]={2,2};
double origin_x= 0;
double origin_y=0;
double origin[] = {origin_x, origin_y};
ImageType::IndexType index;
img->SetOrigin(origin);
img->SetSpacing(values); // here I have already a problem at RebuildTransform() method
ImageType::SizeType imagesize;
imagesize[0] = 256;
imagesize[1] = 256;
ImageType::RegionType region;
region.SetSize( imagesize );
img->SetLargestPossibleRegion( region );
img->SetBufferedRegion( region );
img->SetRequestedRegion(region);
img->Allocate();
img->SetPixelContainer(import);
img->Update();
/******** connectedThresholdImageFilter***********/
typedef itk::ConnectedThresholdImageFilter<ImageType,ImageType> FilterType;
FilterType::Pointer filter = FilterType::New();
filter->SetInput(img);
FilterType::IndexType seed; seed[0] = 165; seed[1] = 90;
filter->SetSeed(seed);
filter->SetLower(0);
filter->SetUpper(255);
filter->SetReplaceValue(255);
filter-> Update();// here iot doesn't work because of the dynamic-cast of copyInformation method.
---------------------------------
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Testez le nouveau Yahoo! Mail
--0-1612891888-1040224082=:91036
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
<P>Could anyone tell what's wrong with these lines. I'm stagnating since yesterday and no solution is suggested to my problem. Please it is urgent
<P> /*** this is for importing pixel values from an unsigned char type pointer **/
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<P>itk::ImportImageContainer<long unsigned int, unsigned char>::Pointer import;<BR> import = itk::ImportImageContainer<long unsigned int, unsigned char>::New();<BR> import->Initialize();<BR> import->Reserve(size[0]*size[1]);<BR> import->SetImportPointer(labeled_image2,size[0]*size[1],false);</P>
<P>/****setting the pixel values in the itkimage****/
<P>typedef itk::Image<unsigned char, 2> ImageType;<BR> ImageType:: Pointer img = ImageType::New();
<P> double values[]={2,2};<BR> double origin_x= 0;<BR> double origin_y=0;<BR> double origin[] = {origin_x, origin_y};<BR> ImageType::IndexType index;<BR> img->SetOrigin(origin);<BR> img->SetSpacing(values); // here I have already a problem at RebuildTransform() method
<P> ImageType::SizeType imagesize;<BR> imagesize[0] = 256;<BR> imagesize[1] = 256;<BR> <BR> ImageType::RegionType region;<BR> region.SetSize( imagesize );<BR> <BR> img->SetLargestPossibleRegion( region );<BR> img->SetBufferedRegion( region );<BR> img->SetRequestedRegion(region);<BR> img->Allocate();<BR> img->SetPixelContainer(import);<BR> img->Update();
<P>/******** connectedThresholdImageFilter***********/
<P>typedef itk::ConnectedThresholdImageFilter<ImageType,ImageType> FilterType;
<P> FilterType::Pointer filter = FilterType::New();<BR> filter->SetInput(img);<BR> FilterType::IndexType seed; seed[0] = 165; seed[1] = 90;<BR> filter->SetSeed(seed);<BR> filter->SetLower(0);<BR> filter->SetUpper(255);<BR> filter->SetReplaceValue(255);<BR> filter-> Update();// here iot doesn't work because of the dynamic-cast of copyInformation method. </P></BLOCKQUOTE><p><br><hr size=1>Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !<br>
<a href=http://fr.mail.yahoo.com>Testez le nouveau Yahoo! Mail</a>
--0-1612891888-1040224082=:91036--