[Insight-users] empty image as output in Windows
Xabier Artaechevarria Artieda
xabiarta at unav.es
Mon Apr 7 08:36:49 EDT 2008
Hi,
Sorry, problem partially solved, it happens only with Dicom files.
--
Xabier Artaechevarria
Cancer Imaging Laboratory
Centre for Applied Medical Research
www.cima.es
Xabier Artaechevarria Artieda <xabiarta at unav.es> ha escrito:
> Hi all,
> I moved from Linux to Windows and I am having a problem with a filter I
> developed.
> It worked in Linux, but when I compile with Visual Studio 2003 the
> output image is 0. The program should not be changed, should it? What
> can the problem be?
> I allocate memory and the iterators seem to work fine, but it is as if
> the pipeline did not work properly.
> Thanks for your help and regards,
> Xabi
>
> // generate data
>
> template< class TInputImage, class TOutputImage >
> void
> HuThresholdImageFilter< TInputImage, TOutputImage >
> ::GenerateData()
> {
> itkDebugMacro(<< "HuThresholdImageFilter::GenerateData() called");
>
> // Get the input and output pointers
> InputImageConstPointer inputPtr = this->GetInput(0);
> OutputImagePointer outputPtr = this->GetOutput();
> this->AllocateOutputs();
>
> // Iterator Typedefs for this routine
> typedef ImageRegionConstIterator<TInputImage> InputIterator;
> typedef ImageRegionIterator<TOutputImage> OutputIterator;
> typedef RegionFilter<TOutputImage, TOutputImage> RegionFilter;
>
> OutputImageRegionType Region;
>
> typename TOutputImage::Pointer imagen = TOutputImage::New();
> outputPtr->SetRegions( inputPtr->GetLargestPossibleRegion() );
> outputPtr->Allocate();
>
> InputIterator in = InputIterator (inputPtr,
> inputPtr->GetRequestedRegion());
>
> OutputIterator it = OutputIterator(outputPtr,
> inputPtr->GetLargestPossibleRegion());
> double Ti=m_Ti;
> std::cout << Ti << std::endl;
> //Bucle para buscar el mejor Ti
> double ub, un, Nb, Nn, Tii, i;
> Tii = 0;
> i=1;
> //Ti=33000;
> //Create mask
> for ( in.GoToBegin(), it.GoToBegin(); !in.IsAtEnd(), !it.IsAtEnd();
> ++in, ++it )
> {
> if(in.Get()>=Ti)
> {
> it.Set(1);
>
> }
> else
> {
> it.Set(0);
> }
> }
>
> while (fabs(Tii-Ti)>m_Diff)
> {
> for ( in.GoToBegin(), it.GoToBegin(); !in.IsAtEnd(); ++in, ++it )
> {
> if (it.Get())
> {
> ub=ub+in.Get();
> Nb++;
> }
> else
> {
> un=un+in.Get();
> Nn++;
> }
> }
> if (Nb!=0) ub=ub/Nb;
> else ub=0;
> if (Nn!=0) un=un/Nn;
> else un=0;
> Ti=Tii;
>
> std::cout << "un" << un << std::endl;
> Tii=(ub+un)/2;
> ub=0;un=0;
> Nn=0;Nb=0;
> i++;
> std::cout << "Iteration: " << i << std::endl;
> std::cout << "Threshold: " << Tii << std::endl;
> for ( in.GoToBegin(), it.GoToBegin(); !in.IsAtEnd(); ++in, ++it )
> {
> it.Set( in.Get()>=Tii );
> }
> }
>
>
> this->GraftOutput(outputPtr);
>
>
>
> }
> --
> Xabier Artaechevarria
> Cancer Imaging Laboratory
> Centre for Applied Medical Research
> www.cima.es
>
>
>
> ----------------------------------------------------------------
> Este mensaje ha sido enviado desde https://webmail.unav.es
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
----------------------------------------------------------------
Este mensaje ha sido enviado desde https://webmail.unav.es
More information about the Insight-users
mailing list