Beispiel #1
0
 public List <PCA /*_Synth*/> pcaSynth()
 {
     if (Globals.isDefined("4D"))
     {
         return(m_PCASynth_4Drecoloring);
     }
     else
     {
         return(m_PCASynth);
     }
 }
Beispiel #2
0
        // -----------------------------------------------------


        int computeStackLevels(MultiDimFloatTexture tex, bool toroidal, ref MultiDimFloatTexture[] _lvls)
        {
            MultiDimFloatTexture large = enlargeTexture(tex, toroidal ? 0 : 1);
            int nlvl = 0;

            if (Globals.isDefined("gauss") || Globals.FORCE_GAUSS)
            {
                if (Globals.PRINT_DEBUG_MSG)
                {
                    Debug.Print("(using Gauss filter)");
                }
                nlvl = computeStackLevels_Gauss(large, ref _lvls);
            }
            else
            {
                nlvl = computeStackLevels_Box(large, ref _lvls);
            }
            large = null;
            return(nlvl);
        }
Beispiel #3
0
        void computeSynthNeighborhoods()
        {
            ScopeTimer tm = new ScopeTimer("[computeSynthNeighborhoods]");

            m_SynthNeighborhoods = new NeighborhoodSynth[mNumLevels][];

            // foreach level
            for (int level = 0; level < mNumLevels; level++)
            {
                MultiDimFloatTexture recolored_level = null;

                if (Globals.isDefined("4D"))
                {
                    // . keep only 4 dimension from recolored exemplar
                    MultiDimFloatTexture level_4D = new MultiDimFloatTexture(mOwner.recoloredStack(level).width(), mOwner.recoloredStack(level).height(), mOwner.recoloredStack(level).numComp());
                    int w = level_4D.getWidth();
                    int h = level_4D.getHeight();
                    Globals.Assert(w == mOwner.stack(level).getWidth() && h == mOwner.stack(level).height());
                    Globals.Assert(level_4D.numComp() == Globals.NUM_RECOLORED_PCA_COMPONENTS);
                    for (int i = 0; i < w; i++)
                    {
                        for (int j = 0; j < h; j++)
                        {
                            // . copy first four channels
                            for (int c = 0; c < 4; c++)
                            {
                                level_4D.set(mOwner.recoloredStack(level).get(i, j, c), i, j, c);
                            }
                            // . zero out all channels above 4
                            for (int c = 4; c < level_4D.numComp(); c++)
                            {
                                level_4D.set(0, i, j, c);
                            }
                        }
                    }
                    recolored_level = level_4D;
                }
                else
                {
                    // . keep all dimensions
                    recolored_level = mOwner.recoloredStack(level);
                }

                m_SynthNeighborhoods[level] = new NeighborhoodSynth[recolored_level.width() * recolored_level.height()];

                stack_accessor_v2 access = new stack_accessor_v2(level);


                for (int j = 0; j < recolored_level.height(); j++)
                {
                    for (int i = 0; i < recolored_level.width(); i++)
                    {
                        int index = i + j * recolored_level.width();
                        m_SynthNeighborhoods[level][index] = new NeighborhoodSynth();
                        m_SynthNeighborhoods[level][index].construct(
                            recolored_level,
                            access,
                            (!mOwner.isToroidal()) && level < (mNumLevels - Globals.NUM_LEVELS_WITHOUT_BORDER),
                            //(!m_bToroidal) && l < FIRST_LEVEL_WITH_BORDER,
                            level, i, j);
                    }
                }
            }

            tm.destroy();
            tm = null;
        }