<div dir="ltr">Where does info->patient_orientation come from?  Is it the cross product of patient_row_orientation and patient_col_orientation?<br><div class="gmail_extra"><br></div><div class="gmail_extra">The line "<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">imgdata->DeepCopy(reslice-></span><wbr style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">GetOutput());" looks like a mistake, is it meant to be "<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">imgdata->DeepCopy(<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">imgchangeinfo</span>-></span><wbr style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">GetOutput());"?  And where does the "imgdata" object come from?  Note that it is only safe to DeepCopy into a data object that you create yourself, it isn't safe to DeepCopy into an object that is the output of a VTK algorithm.</span></span></div><div class="gmail_extra"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></span></div><div class="gmail_extra"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Also, the output of vtkTransformFilter is a vtkStructuredGrid, not a vtkImageData, so it seems like an unusual filter to use in a VTK image display pipeline.</span></span></div><div class="gmail_extra"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></span></div><div class="gmail_extra">For the problem with multi-frame files, my guess is that you depend on proper sorting of the DICOM files in order to properly reconstruct the volume, and file sorting doesn't work if there is only one file.  Instead, it is necessary to sort the frames, but how to do this depends on what kind of multi-frame file you have (e.g. NM vs enhanced MR/CT/US).</div><div class="gmail_extra"><br></div><div class="gmail_extra">If you're curious, you can see my own DICOM file/frame sorting code here:</div><div class="gmail_extra"><a href="https://github.com/dgobbi/vtk-dicom/blob/master/Source/vtkDICOMSliceSorter.cxx#L414">https://github.com/dgobbi/vtk-dicom/blob/master/Source/vtkDICOMSliceSorter.cxx#L414</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"> - David</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 5, 2018 at 2:30 AM, scofield zhu <span dir="ltr"><<a href="mailto:scofieldzhu.zcg@gmail.com" target="_blank">scofieldzhu.zcg@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">hi david,<div>     I use vtkGDCMImageReader(gdcm2.8.5) to read dicom serires image, and SetFileLowerLeftOn() called too. after success reading, the process image codes as following:</div><div>______________________________<wbr>______________________________<wbr>_________________</div><div>       Point3 data_origin = imgdata->GetOrigin();</div><div>    Point3 dataorigin = info->origin;</div><div>    Point3 patient_position = info->patient_position;</div><div><br></div><div>    //here: i am sure:data_origin is equal with both dataorigin and patient_position</div><div><br></div><div>    Vec3 row_orient = info->patient_row_orientation;</div><div>    Vec3 col_orient = info->patient_col_orientation;</div><div>    Vec3 slice_orient = info->patient_orientation;</div><div><br></div><div>    vtkMatrix4x4* matrix = vtkMatrix4x4::New();</div><div>    matrix->Identity();</div><div>    matrix->SetElement(0, 0, row_orient[0]);</div><div>    matrix->SetElement(0, 1, row_orient[1]);</div><div>    matrix->SetElement(0, 2, row_orient[2]);</div><div>    matrix->SetElement(1, 0, col_orient[0]);</div><div>    matrix->SetElement(1, 1, col_orient[1]);</div><div>    matrix->SetElement(1, 2, col_orient[2]);</div><div>    matrix->SetElement(2, 0, slice_orient[0]);</div><div>    matrix->SetElement(2, 1, slice_orient[1]);</div><div>    matrix->SetElement(2, 2, slice_orient[2]);</div><div><br></div><div>    vtkMatrix4x4* inverse_matrix = vtkMatrix4x4::New();</div><div>    matrix->Invert(matrix, inverse_matrix);</div><div>    double new_origin[4] = {0.0};</div><div>    new_origin[3] = 1.0;</div><div>    inverse_matrix->MultiplyPoint(<wbr>data_origin, new_origin);</div><div>    inverse_matrix->Delete();</div><div><br></div><div>    vtkImageChangeInformation* imgchangeinfo = vtkImageChangeInformation::<wbr>New();</div><div>    imgchangeinfo-><wbr>SetOutputOrigin(new_origin[0], new_origin[1], new_origin[2]);</div><div>    imgchangeinfo->SetInputData(<wbr>imgdata);</div><div>    imgchangeinfo->Update();</div><div>    imgdata->DeepCopy(reslice-><wbr>GetOutput());</div><div>    imgchangeinfo->Delete();</div><div><br></div><div>    vtkTransformFilter* transform_filter = vtkTransformFilter::New();</div><div>    vtkTransform* patient_transform = vtkTransform::New();</div><div>    patient_transform->SetMatrix(<wbr>matrix);</div><div>    transform_filter-><wbr>SetTransform(patient_<wbr>transform);</div><div>    transform_filter-><wbr>SetInputData(imgdata);</div><div>    transform_filter->Update();</div><div>    imgdata->DeepCopy(transform_<wbr>filter->GetOutputDataObject(0)<wbr>);</div><div>    transform_filter->Delete();</div><div>    patient_transform->Delete();</div><div>    matrix->Delete();</div><div><br></div><div>______________________________<wbr>______________________________<wbr>______________</div><div><br></div><div>    it works ok in some dicom series image, but not working for some series image especially single dcm file with multi-frame.</div><div><br></div><div>    what's wrong in my code? please help me ! thanks a lot!</div><div><br></div></div></blockquote></div></div></div>