2016-03-31 5 views
-1

ここでは、Ilnumerics使用コミュニティバージョンのボリュームスライスをプロットするための例があります。これは私は、MATLABウェブサイトから取得した例である。数値計算スライスをプロットする例をお探しください

Volumetric slice image example of matlab

Iカラープロットの値としてposistions及びV(速度)として配列X、Y、Zを有します。私がしたのは、Ilpointsを使ってVを位置X、Y、Zに描き、サーフェスを描くことだけでした。ここに私のコードと結果があり、ここで

ILArray<float> plotXY = ILMath.zeros<float>(3, XcoordinateXY.Length); 
     plotXY["0;:"] = ILMath.tosingle(SurfaceXY[":;:;1"]); 
     plotXY["1;:"] = ILMath.tosingle(SurfaceXY[":;:;2"]); 
     plotXY["2;:"] = ILMath.tosingle(SurfaceXY[":;:;3"]); 

     ILArray<float> ColorMap = ILMath.tosingle(SurfaceXY[":;:;0"]); 

var ilsurfaceplotXY = new ILPoints() 
     { 

      /*Wireframe = { Color = Color.FromArgb(50, Color.LightGray) }, 
      Colormap = new ILColormap(dataXY), 
      Children = { new ILColorbar() }*/ 
      Positions = plotXY, 
      Colors = cm.Map(ColorMap).T, 
      Color = null 
     }; 

は、表示するためのコードです:

var scene = new ILScene(); 
     scene.Add(
       new ILPlotCube 
       { 
        TwoDMode = false, 
        Axes = 
        { 

         XAxis = 
         { 
          Label = { Text = "UTM X (Km)" }, 
          GridMajor = 
          { 
           DashStyle = DashStyle.Dashed, 
           Color = Color.DarkGray, 
           Width = 1 

          } 
         }, 
         YAxis = 
         { 
          Label = { Text = "UTM Y (Km)" }, 
          GridMajor = 
          { 
           DashStyle = DashStyle.Dashed, 
           Color = Color.DarkGray, 
           Width = 1 
          } 
         }, 
         ZAxis = 
         { 
          Label = { Text = "DEPTH (Km)" }, 
          GridMajor = 
          { 
           DashStyle = DashStyle.Dashed, 
           Color = Color.DarkGray, 
           Width = 1 
          } 
         } 
        }, 

        Children = { ilsurfaceplotXY, ilsurfaceplotXZ, ilsurfaceplotYZ }, 
       } 
      ); 

     this.ilPanel1.Scene = scene; 
     this.ilPanel1.Scene.Configure(); 
     this.ilPanel1.Refresh(); 

そしてここでは、画像の結果です。

Result Image

私はイメージがリンクしているごめんなさい。

答えて

1

視覚化に関しては、これはregular surfaces,imagesc plots、またはDrawing2ツールボックスの新しい高速表面で行うことができます。それらはすべて、X、Y、Zの値と各格子点またはタイルの色を提供することができます。

ポイントの計算に関して:使用可能なセットからポイントを選択するように思われます。これらの点を補間する方がはるかに良いでしょう。 Interpolation Toolboxには、グリッドデータと散在データの補間機能があります。 (あなたの場合、データはグリッド化されているようですか?)これにより、任意の向き/角度のスライスが可能になります。補間ツールボックスは、スライスグリッドポイントの位置と色の値を補間します。 online exampleから

次のように

Interpolation and visualization of sliced data from volumes

水平スライスの設定が行われます。ここでは

ILArray<float> C; 
for (int i = 0; i < m_nrSlices; i += m_nrSlices/4) { 
    C = m_V[":",":", i]; 
    pc1.Add(new ILSurface(grid + i, C, colormap: Colormaps.Bone) 
    { 
     Wireframe = { Visible = false }, 
    }); 

}

m_Vとして扱い、あなたの3Dデータセットです3Dアレイ。 pcはプロットキューブです。サーフェスは単純にプロットキューブに追加されます。赤い補間領域のポイントは、ユーザーが赤いボールを動かすと動的に計算されます。

// Points on the cutting area are considered scattered points, because the area is not (necessarily) plain. However, V 
// is a grid. interp3s interpolates the scattered points very efficiently. 
// Note how the shape of the coordinate arrays Xn, Yn and Zn is not important. interp3s takes their elements in sequential order. 
// The output is a vector of interpolated values. (We gonna reshape it below.) 
ILArray < float> Z = Interpolation.interp3s(m_V, m_x, m_x, m_x, m_Xn, m_Yn, Zn, method: InterpolationMethod.cubic); 

// let's plot! We get a reference to the fast surface 
var fsurf = ilPanel1.Scene.First<ILFastSurface>("dynslice"); 
if (fsurf != null) { 
    // first time setup only: provide the full coordinates of X and V. Here it is sufficient to provide grid vectors. 
    if (fsurf.Cols == 0) { 
     fsurf.Update(X: m_xn * res, Y: m_xn * res, Z: Zn * res, C: ILMath.reshape(Z, Zn.S), colormap: Colormaps.Hot); 
    } else { 
     // the grid was configured already and did not change. we save some recomputing by ommiting the X and Y coordinates, prevent from reshaping buffers. 
     fsurf.Update(Z: Zn * res, C: ILMath.reshape(Z, Zn.S), colormap: Colormaps.Hot); 
    } 
} 
fsurf.Configure(); 
ilPanel1.Refresh(); 

詳細については、範囲外です。このサンプルをダウンロードして、マシン上で実行することができます。あなたはILNumericsのrecent versionが必要になります。

編集:あなたが提供したプロットのような軸合わせスライスは、もちろんサブドメインだけです。それらを生成すると、非常に同じように動作します: enter image description here

+0

私はSOの答えとしてupvoteとマークすることであるに感謝を言うための方法for..thankyouそんなに@Haymo Kutschbach – Cas

+0

を見て何であること。) –

関連する問題