<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Batang;
panose-1:2 3 6 0 0 1 1 1 1 1;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Malgun Gothic";
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"\@Batang";
panose-1:2 3 6 0 0 1 1 1 1 1;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"\@Malgun Gothic";
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi Karthik,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I did as you suggested. Unfortunately it did not work. Still if I paint or erase some part on one slice, the connected slices are also painted or erased. Please check the code I modified from paintbrushtest6.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:blue'>int</span><span style='font-size:10.0pt;font-family:"Courier New"'> main( <span style='color:blue'>int</span> argc, <span style='color:blue'>char</span> *argv[] )<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>{<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>  vtkKWEPaintbrushTesting *paintbrushTesting = vtkKWEPaintbrushTesting::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> paintbrushTesting->SetFilename( <span style='color:#A31515'>"C:/Users/User/Desktop/CT data/SWS/Diffusion/mha/3D.mha"</span> );<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> paintbrushTesting->Initialize();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> vtkImageData * imageData = paintbrushTesting->GetInput();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> vtkKWEWidgetGroup *set = vtkKWEWidgetGroup::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:blue'>for</span> (<span style='color:blue'>int</span> i = 0; i < 1; i++)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   vtkKWEPaintbrushWidget *w = vtkKWEPaintbrushWidget::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   w->SetInteractor( paintbrushTesting->GetNthImageViewer(i)-><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>                     GetRenderWindow()->GetInteractor());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   vtkKWEPaintbrushRepresentationGrayscale2D * rep =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>               vtkKWEPaintbrushRepresentationGrayscale2D::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   w->SetRepresentation(rep);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   <span style='color:blue'>if</span> (rep)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>     {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>     vtkImageActor * imageActor = paintbrushTesting->GetNthImageActor(i);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>     rep->SetImageActor(imageActor);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>     rep->SetImageData(imageData);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>     <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>       <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>       rep->GetPaintbrushOperation()->GetPaintbrushShape()->SetSpacing(<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>         imageData->GetSpacing() );<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>     <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>      rep->GetPaintbrushOperation()->GetPaintbrushShape()->SetOrigin(<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>         imageData->GetOrigin() );     <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>      }<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   set->AddWidget(w);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   rep->Delete();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   w->Delete();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   }<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> vtkKWEPaintbrushRepresentation2D * repx =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   vtkKWEPaintbrushRepresentation2D::SafeDownCast(<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>     set->GetNthWidget(0)->GetRepresentation());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> vtkKWEPaintbrushDrawing * drawingx = repx->GetPaintbrushDrawing();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:blue'>for</span> (<span style='color:blue'>unsigned</span> <span style='color:blue'>int</span> i = 0; i < set->GetNumberOfWidgets(); i++)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   vtkKWEPaintbrushRepresentation2D * repr =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>     vtkKWEPaintbrushRepresentation2D::SafeDownCast(<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>       set->GetNthWidget(i)->GetRepresentation());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   repr->SetPaintbrushDrawing( drawingx );<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   }<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>// Now read in an initial segmentation.<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:green'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> vtkKWEPaintbrushRepresentation2D * rep =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   vtkKWEPaintbrushRepresentation2D::SafeDownCast(<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>     set->GetNthWidget(0)->GetRepresentation());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> vtkKWEPaintbrushDrawing * drawing = rep->GetPaintbrushDrawing();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> drawing->InitializeData();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> vtkKWEPaintbrushGrayscaleData *data = vtkKWEPaintbrushGrayscaleData::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>// Read the file (initial segmentation)<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> vtkMetaImageReader * reader = vtkMetaImageReader::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> reader->SetFileName( <span style='color:#A31515'>"C:/Users/User/Desktop/CT data/SWS/Hole_filled/LabelMap/3D.mha"</span> );<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> reader->Update();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> data->SetImageData(reader->GetOutput());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> reader->Delete();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>// Set the first stroke as the initial segmentation.<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> drawing->AddNewStroke(0, vtkKWEPaintbrushEnums::Draw, data);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>// Instead of the above line, you can set this directly as the new stencil,<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>// saves some memory, as the overhead data of an extra stroke need not be<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>// managed.<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>// drawing->SetPaintbrushData(data);<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New";color:green'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:blue'>for</span> (<span style='color:blue'>unsigned</span> <span style='color:blue'>int</span> i = 0; i < set->GetNumberOfWidgets(); i++)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   vtkKWEPaintbrushRepresentation * repr =<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>     vtkKWEPaintbrushRepresentation::SafeDownCast(<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>       set->GetNthWidget(i)->GetRepresentation());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   repr->SetPaintbrushDrawing( drawing );<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   }<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> set->SetEnabled(1);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> paintbrushTesting->Run();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>// Save out the resulting segmentation.<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>//<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> vtkImageData * output = vtkImageData::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> drawing->GetPaintbrushData()-><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>                   GetPaintbrushDataAsImageData( output );<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> vtkMetaImageWriter * outputWriter = vtkMetaImageWriter::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> outputWriter->SetFileName(<span style='color:#A31515'>"Drawing.mha"</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> outputWriter->SetInput( output );<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> outputWriter->Write();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>// Save out each of the resulting segmentations.<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:green'>//<o:p></o:p></span></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:blue'>for</span> (<span style='color:blue'>int</span> i = 0; i < drawing->GetNumberOfItems(); i++)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   vtkImageData * outputN = vtkImageData::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   drawing->GetItem(i)->GetPaintbrushData()-><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>                   GetPaintbrushDataAsImageData( outputN );<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   vtkMetaImageWriter * outputWriterN = vtkMetaImageWriter::New();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   std::ostringstream filenameN;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   filenameN << <span style='color:#A31515'>"Drawing"</span> << i << <span style='color:#A31515'>".mha"</span> << std::ends;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   outputWriterN->SetFileName(filenameN.str().c_str());<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   outputWriterN->SetInput( outputN );<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   outputWriterN->Write();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   outputWriterN->Delete();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   outputN->Delete();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'>   }<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> data->Delete();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> outputWriter->Delete();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> output->Delete();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> set->Delete();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> paintbrushTesting->Delete();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'> <span style='color:blue'>return</span> 0;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>}</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span lang=ZH-CN style='font-size:10.0pt;font-family:宋体'>å‘件人</span></b><b><span style='font-size:10.0pt;font-family:宋体'>:</span></b><span style='font-size:10.0pt;font-family:宋体'> Karthik Krishnan [mailto:karthik.krishnan@kitware.com] <br><b><span lang=ZH-CN>å‘é€æ—¶é—´</span>:</b> 2011</span><span lang=ZH-CN style='font-size:10.0pt;font-family:"Batang","serif"'>ë…„</span><span style='font-size:10.0pt;font-family:宋体'> 3</span><span lang=ZH-CN style='font-size:10.0pt;font-family:"Batang","serif"'>ì›”</span><span style='font-size:10.0pt;font-family:宋体'> 28</span><span lang=ZH-CN style='font-size:10.0pt;font-family:"Batang","serif"'>ì¼</span><span lang=ZH-CN style='font-size:10.0pt;font-family:宋体'> </span><span lang=ZH-CN style='font-size:10.0pt;font-family:"Batang","serif"'>월요ì¼</span><span lang=ZH-CN style='font-size:10.0pt;font-family:宋体'> </span><span lang=ZH-CN style='font-size:10.0pt;font-family:"Batang","serif"'>오후</span><span style='font-size:10.0pt;font-family:宋体'> 5:16<br><b><span lang=ZH-CN>收件人</span>:</b> Xiaopeng Yang<br><b><span lang=ZH-CN>抄é€</span>:</b> vtk; VtkEdge@vtkedge.org<br><b><span lang=ZH-CN>主题</span>:</b> Re: [vtkusers] How to make the paintbrush paint only on one slice, not on the neighbor slices<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Ok.. I made the API simpler that setting the shape size...<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>If you do :<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> paintbrushRepresentation2D->SetSingleSliceThickBrush(true);<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>you will get a slice by slice edit, ie the edits will be confined to the a single slice on all your views (axial/coronal/sagittal).<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>That's it :). I checked this in a few weeks ago. So please be sure to update the repository.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>----<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>The issue with setting the Shape size to flatten along an axis was that this had to be managed at the application level, since you have to flatten the shape when you switch views.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Thanks<o:p></o:p></p></div><div><p class=MsoNormal>--<o:p></o:p></p></div><div><p class=MsoNormal>karthik<o:p></o:p></p></div><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Mon, Mar 28, 2011 at 5:54 AM, Xiaopeng Yang <<a href="mailto:yxp233@postech.ac.kr">yxp233@postech.ac.kr</a>> wrote:<o:p></o:p></p><p class=MsoNormal>Sorry I mean "Hello" not "Hell".<o:p></o:p></p><div><p class=MsoNormal><br>-----<span lang=ZH-CN style='font-family:宋体'>é‚®</span><span lang=ZH-CN style='font-family:"Batang","serif"'>件原件</span>-----<br><span lang=ZH-CN style='font-family:宋体'>å‘</span><span lang=ZH-CN style='font-family:"Batang","serif"'>件人</span>: Xiaopeng Yang [mailto:<a href="mailto:yxp233@postech.ac.kr">yxp233@postech.ac.kr</a>]<o:p></o:p></p></div><p class=MsoNormal><span lang=ZH-CN style='font-family:宋体'>å‘</span><span lang=ZH-CN style='font-family:"Batang","serif"'>é€</span><span lang=ZH-CN style='font-family:宋体'>时间</span>: 2011<span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>ë…„</span> 3<span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>ì›”</span> 28<span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>ì¼</span><span lang=ZH-CN> </span><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>월요ì¼</span><span lang=ZH-CN> </span><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>ì˜¤ì „</span> 9:24<o:p></o:p></p><div><p class=MsoNormal><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>收件人</span>: 'Karthik Krishnan'<br><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>抄é€</span>: 'vtk'; '<a href="mailto:VtkEdge@vtkedge.org">VtkEdge@vtkedge.org</a>'<o:p></o:p></p></div><p class=MsoNormal><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>主</span><span lang=ZH-CN style='font-family:宋体'>题</span>: RE: [vtkusers] How to make the paintbrush paint only on one slice, not on the neighbor slices<o:p></o:p></p><div><div><p class=MsoNormal><br>Hell Karthik,<br><br>Sorry to send this question again. Since I did not receive your reply yet. My question how to set the paintbrush width? I did as you suggested before, but it said that 'SetWidth' is not a function of 'vtkKWPaintbrushShape'.<br><br>Please help me!<br><br>Thanks a lot,<br>Yang<br><br>-----<span lang=ZH-CN style='font-family:宋体'>é‚®</span><span lang=ZH-CN style='font-family:"Batang","serif"'>件原件</span>-----<br><span lang=ZH-CN style='font-family:宋体'>å‘</span><span lang=ZH-CN style='font-family:"Batang","serif"'>件人</span>: Xiaopeng Yang [mailto:<a href="mailto:yxp233@postech.ac.kr">yxp233@postech.ac.kr</a>]<br><span lang=ZH-CN style='font-family:宋体'>å‘</span><span lang=ZH-CN style='font-family:"Batang","serif"'>é€</span><span lang=ZH-CN style='font-family:宋体'>时间</span>: 2011<span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>ë…„</span> 3<span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>ì›”</span> 23<span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>ì¼</span><span lang=ZH-CN> </span><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>수요ì¼</span><span lang=ZH-CN> </span><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>오후</span> 8:49<br><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>收件人</span>: 'Karthik Krishnan'<br><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>抄é€</span>: 'vtk'; '<a href="mailto:VtkEdge@vtkedge.org">VtkEdge@vtkedge.org</a>'<br><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>主</span><span lang=ZH-CN style='font-family:宋体'>题</span>: RE: [vtkusers] How to make the paintbrush paint only on one slice, not on the neighbor slices<br><br>Hi Karthik,<br><br>I tried to set the width of paintbrush. But the it said that SetWidth is not a function of 'vtkKWPaintbrushShape'. I added your code to the program (PaintbrushTest6) as follows:<br><br><br> vtkKWEPaintbrushTesting *paintbrushTesting = vtkKWEPaintbrushTesting::New();<br> paintbrushTesting->SetFilename( "D:/Hybrid Method/Hybrid/SWS/Diffusion_filter/mha/3D.mha" );<br> paintbrushTesting->Initialize();<br> vtkImageData * imageData = paintbrushTesting->GetInput();<br><br> vtkKWEWidgetGroup *set = vtkKWEWidgetGroup::New();<br><br> for (int i = 0; i < 3; i++)<br> {<br> vtkKWEPaintbrushWidget *w = vtkKWEPaintbrushWidget::New();<br> w->SetInteractor( paintbrushTesting->GetNthImageViewer(i)-><br> GetRenderWindow()->GetInteractor());<br> vtkKWEPaintbrushRepresentationGrayscale2D * rep =<br> vtkKWEPaintbrushRepresentationGrayscale2D::New();<br> w->SetRepresentation(rep);<br> if (rep)<br> {<br> vtkImageActor * imageActor = paintbrushTesting->GetNthImageActor(i);<br> rep->SetImageActor(imageActor);<br> rep->SetImageData(imageData);<br> rep->GetPaintbrushOperation()->GetPaintbrushShape()->SetSpacing(<br> imageData->GetSpacing() );<br> rep->GetPaintbrushOperation()->GetPaintbrushShape()->SetOrigin(<br> imageData->GetOrigin() );<br><br> //********************************************************************************<br> rep->GetPaintbrushOperation()->GetPaintbrushShape()->SetWidth(<br> xx, xx, xx);<br> //********************************************************************************<br> }<br><br> set->AddWidget(w);<br> rep->Delete();<br> w->Delete();<br> }<br><br> vtkKWEPaintbrushRepresentation2D * repx =<br> vtkKWEPaintbrushRepresentation2D::SafeDownCast(<br> set->GetNthWidget(0)->GetRepresentation());<br> vtkKWEPaintbrushDrawing * drawingx = repx->GetPaintbrushDrawing();<br> for (unsigned int i = 0; i < set->GetNumberOfWidgets(); i++)<br> {<br> vtkKWEPaintbrushRepresentation2D * repr =<br> vtkKWEPaintbrushRepresentation2D::SafeDownCast(<br> set->GetNthWidget(i)->GetRepresentation());<br> repr->SetPaintbrushDrawing( drawingx );<br> }<br><br> // Now read in an initial segmentation.<br><br> vtkKWEPaintbrushRepresentation2D * rep =<br> vtkKWEPaintbrushRepresentation2D::SafeDownCast(<br> set->GetNthWidget(0)->GetRepresentation());<br><br> vtkKWEPaintbrushDrawing * drawing = rep->GetPaintbrushDrawing();<br> drawing->InitializeData();<br> vtkKWEPaintbrushGrayscaleData *data = vtkKWEPaintbrushGrayscaleData::New();<br><br> // Read the file (initial segmentation)<br> vtkMetaImageReader * reader = vtkMetaImageReader::New();<br> reader->SetFileName( "D:/Hybrid Method/Hybrid/SWS/Threshold_LS/Hole filled/LabelMap/3D.mha" );<br> reader->Update();<br> data->SetImageData(reader->GetOutput());<br> reader->Delete();<br><br> // Set the first stroke as the initial segmentation.<br> drawing->AddNewStroke(0, vtkKWEPaintbrushEnums::Draw, data);<br><br> // Instead of the above line, you can set this directly as the new stencil,<br> // saves some memory, as the overhead data of an extra stroke need not be<br> // managed.<br> // drawing->SetPaintbrushData(data);<br><br> for (unsigned int i = 0; i < set->GetNumberOfWidgets(); i++)<br> {<br> vtkKWEPaintbrushRepresentation * repr =<br> vtkKWEPaintbrushRepresentation::SafeDownCast(<br> set->GetNthWidget(i)->GetRepresentation());<br> repr->SetPaintbrushDrawing( drawing );<br> }<br><br> set->SetEnabled(1);<br> paintbrushTesting->Run();<br><br><br> // Save out the resulting segmentation.<br> //<br> vtkImageData * output = vtkImageData::New();<br> drawing->GetPaintbrushData()-><br> GetPaintbrushDataAsImageData( output );<br> vtkMetaImageWriter * outputWriter = vtkMetaImageWriter::New();<br> outputWriter->SetFileName("Drawing.mha");<br> outputWriter->SetInput( output );<br> outputWriter->Write();<br><br> // Save out each of the resulting segmentations.<br> //<br> for (int i = 0; i < drawing->GetNumberOfItems(); i++)<br> {<br> vtkImageData * outputN = vtkImageData::New();<br> drawing->GetItem(i)->GetPaintbrushData()-><br> GetPaintbrushDataAsImageData( outputN );<br> vtkMetaImageWriter * outputWriterN = vtkMetaImageWriter::New();<br> std::ostringstream filenameN;<br> filenameN << "Drawing" << i << ".mha" << std::ends;<br> outputWriterN->SetFileName(filenameN.str().c_str());<br> outputWriterN->SetInput( outputN );<br> outputWriterN->Write();<br> outputWriterN->Delete();<br> outputN->Delete();<br> }<br><br> data->Delete();<br> outputWriter->Delete();<br> output->Delete();<br> set->Delete();<br> paintbrushTesting->Delete();<br><br> return 0;<br><br><br>-----<span lang=ZH-CN style='font-family:宋体'>é‚®</span><span lang=ZH-CN style='font-family:"Batang","serif"'>件原件</span>-----<br><span lang=ZH-CN style='font-family:宋体'>å‘</span><span lang=ZH-CN style='font-family:"Batang","serif"'>件人</span>: Karthik Krishnan [mailto:<a href="mailto:karthik.krishnan@kitware.com">karthik.krishnan@kitware.com</a>]<br><span lang=ZH-CN style='font-family:宋体'>å‘</span><span lang=ZH-CN style='font-family:"Batang","serif"'>é€</span><span lang=ZH-CN style='font-family:宋体'>时间</span>: 2011<span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>ë…„</span> 3<span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>ì›”</span> 23<span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>ì¼</span><span lang=ZH-CN> </span><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>수요ì¼</span><span lang=ZH-CN> </span><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>오후</span> 5:47<br><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>收件人</span>: Xiaopeng Yang<br><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>抄é€</span>: vtk; <a href="mailto:VtkEdge@vtkedge.org">VtkEdge@vtkedge.org</a><br><span lang=ZH-CN style='font-family:"Malgun Gothic","serif"'>主</span><span lang=ZH-CN style='font-family:宋体'>题</span>: Re: [vtkusers] How to make the paintbrush paint only on one slice, not on the neighbor slices<br><br>I apologize for the delay in getting back to your earlier mails. I<br>hope you've figured those out :).<br><br>To make the paintbrush go into slice by slice edit mode, you simply<br>set the width of the paintbrush shape along that axis to one unit<br>spacing along that axis....<br><br>paintbrushOperation->GetPaintbrushShape()->SetWidth(10,10,spacingZ)<br><br>On 3/23/11, Xiaopeng Yang <<a href="mailto:yxp233@postech.ac.kr">yxp233@postech.ac.kr</a>> wrote:<o:p></o:p></p></div></div><div><div><p class=MsoNormal style='margin-bottom:12.0pt'>> Dear users,<br>><br>><br>><br>> I found that when I painted on one slice of a series of images, the neighbor<br>> slices were also painted. My question is how to make the paintbrush paint<br>> only on that slice, not on the neighbor slices.<br>><br>><br>><br>> Thanks very much in advance!<br>><br>><br>><br>> Yang<br>><br>><br><br><br><br><br><br><br><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>